Welcome!

Recent Posts

  • Kotlin's hidden costs - Benchmarks A series of blog posts called Exploring Kotlin’s hidden costs , written by @BladeCoder, demonstrated how certain Kotlin constructs have a hidden cost. The actual hidden cost is normally due to the instantiation of an invisible Object or the boxing/unboxing of primitive values. These costs are specially hard to see for a developer who doesn't understand how the Kotlin compiler translates such constructs to JVM bytecode. However, just talking about hidden costs without putting some numbers on said costs makes one wonder how much they should actually worry about them. Should these costs be taken into consideration everywhere in the codebase, meaning that some Kotlin constructs should just be forbidden outright? Or should these costs only be taken ...
    Posted Jun 25, 2017, 7:05 AM by Renato Athaydes
  • JGrab - run Java code fast, from source, with a little Rust help One of the main problems Java has, in my opinion, is how hard it is to run a simple Java class without the help of a complex build system. If you don't need any external dependencies, it may be easy enough to run javac Hello.java, followed by java Hello (but even this can get tiring quickly). But if you need dependencies, then it becomes completely impractical to download the dependencies by hand, and then type the full classpath every time you need to run the code. Not to mention the performance of code run in this way is pretty bad (due to the JVM startup and warmup times), even with the great improvements seen in the latest Java ...
    Posted May 21, 2017, 4:24 AM by Renato Athaydes
  • A practical guide to Java 9 - compile, jar, run The java and javac commands are rarely used by Java programmers... build tools like Maven and Gradle make that mostly unnecessary. However, as of writing (April 2017), both Maven and Gradle still don't provide full support for Java 9, so if you want to start using Java 9 now, or if you just want to know how it will all work behind the scenes when you finally start using it with your favourite tool, it is a good thing to learn how to call java, javac and jar to manage your Java code. The purpose of this guide is to show how these command have changed from the previous Java versions (and they did change substantially in Java 9 ...
    Posted Apr 28, 2017, 1:33 PM by Renato Athaydes
  • Writing JVM bytecode by hand using Groovy JVM bytecode looks similar to Assembly code. It maps to it closely enough that translating it into machine code shouldn't be too much of a challenge. Writing it can be quite challenging, but it can be quite useful to understand the inner workings of the JVM. But before we see how to use the Groovy compiler to let us write bytecode by hand (and create pure JVM bytecode that does not require Groovy at runtime!), let's have a quick crash-course on JVM bytecode. A short introduction to JVM bytecode Instructions operate on a frame consisting of an operand stack and an array of local variables (amongst other things). For example, to load the value of an object ...
    Posted Jan 30, 2017, 2:24 PM by Renato Athaydes
  • 4 free ways to hot-swap code on the JVM The JVM is a wonderful piece of engineering with a lot of great features. One feature that many developers don't seem to realize exists is that the JVM (I am referring to Oracle's HotSpot, but this applies to others as well) is capable of hot-swapping code. In plain English, you can load changed code into a running JVM and immediately see the effects of your changes. In this blog post, I will present 4 different ways of doing this, none of which requires paying for a product or license, starting from the rawest, but simplest one, and moving towards more complex (but not necessarily harder-to-use) alternatives. Unfortunately the simplest way is also the least powerful ...
    Posted Feb 18, 2017, 8:06 AM by Renato Athaydes
  • OSGiaaS-CLI - A CLI to run JVM-languages REPL and commands Every now and then, like most technical people, I feel the need to run some CLI (command-line-interface) commands to perform a quick, usually repetitive task. The operating system provides a lot of commands (ls, cat, cp, rm, grep...) that can be wired together to perform certain kinds of tasks (like deploying your application to Amazon, or even finding the cheapest flight somewhere!). There's even a venerable name for this: the Unix philosophy, though this approach can be used in any OS. The Unix-way can make you very productive, so much so that some folks even think that Unix is an IDE because of that. However, a lot of times you will find yourself trying to do ...
    Posted Feb 6, 2017, 11:28 AM by Renato Athaydes
  • Solutions to multiple inheritance in Kotlin I have recently come across a little problem that recurs from time to time as I write new code.I had a base class with some really useful methods that I wanted to make another class extend, but the ditto class already extended some other, equally useful, base class.If this were Java, I would just add a field to the class, using composition rather than inheritance and be done with it, even if that felt a little clunky, after all that's the best you can do in Java.However, these days I'm using Kotlin more often than not. Moving on with the times, I guess!Anyway, Kotlin has a really interesting feature called class delegation, which allows ...
    Posted Nov 29, 2016, 2:23 PM by Renato Athaydes
  • Using Java annotations as pure data values Annotations were introduced to the Java programming language in the 1.5 version, circa 2004. Since then, Java annotations have been adopted with gusto by framework developers, to the point where today, a Java application class might look like little more than scaffold for the annotations themselves, leaving all the actual work to be done by the framework itself.It was not always that way. Initially they were used just to provide additional information to the programmer (@Override, @Deprecated) or the compiler (@SuppressWarnings), but new uses for them have been devised and now include ORMs, serialization, execution control (JUnit), bytecode instrumentation (metaprogramming via annotation processors), Dependency Injection, stricter type-checking and, finally, configuration. Arguably, configuration is the most contested use ...
    Posted Oct 19, 2016, 2:37 AM by Renato Athaydes
  • osgi-run Tutorial - run your Java/Kotlin/Frege code in OSGi What you'll learn in this tutorial:Introductionosgi-run is a Gradle plugin that makes using OSGi as easy as using Gradle.To get started with this tutorial, you need to have Java and Gradle installed. It is assumed you have basic knowledge of both.Some very basic OSGi knowledge is also assumed.To make it easy for you to follow along, a GitHub project was created to back this tutorial.Instead of creating the files described below, you can simply checkout the appropriate git branch and run and modify the code as you wish.The git branch at each stage of the tutorial is shown in bold, blue font, as in the following example where master is the ...
    Posted Sep 4, 2016, 7:41 AM by Renato Athaydes
  • The Ceylon Gradle Plugin Ceylon is a well designed programming language created from scratch to be backend agnostic. This means that it can run as well on JavaScript engines (node.js and browsers) as on the JVM, currently its main backend.     Efforts to get Ceylon running on the Dart VM are well under way. However, my main interest in using Ceylon has been to run code on the JVM, and I noticed that to use Java libraries in Ceylon was not as straightforward as in Java itself using Maven or Gradle. The problem is that, even though Ceylon has its own module dependency resolution engine which works great for Ceylon modules sourced from Herd or local repositories, and which theoretically supports also Maven dependencies ...
    Posted Feb 8, 2016, 8:54 AM by Renato Athaydes
  • Using Swing-Selectors to split up layout-style-logic in UIs with Groovy Introducing Swing-SelectorsSwing-Selectors is a project I've been working on that takes some pretty nice code from the Automaton testing framework (don't worry, it's not stealing, I wrote most of it) and makes it available as a separate library, which makes it easy to, as the name says, select items from a Swing UI.This code is at the core of Automaton's Swinger and lets its users do things like click on something that has the text "click me", or drag the component with name "foo" to "bar", for example.Making it a separate library is a good idea, I think, because Swing developers might want to use the selection mechanisms outside of the ...
    Posted Jun 9, 2016, 10:42 AM by Renato Athaydes
  • Evaluating a programmer's efficiency with realistic programming tasks My wife is an operations management researcher and she is currently working on a thesis about the productivity of information workers at the individual level.It is a difficult issue, of course, but that's why it merits being the subject of a PhD thesis, after all! One of the studies that will serve as a basis for her thesis is called IT-enabled Productivity and its aim is to find out "how information and communication technologies may be used in organizations to contribute to productivity gains".Software developers fall under the category of information workers, and measuring the productivity of software developers is a notoriously difficult problem, even more so, I'd imagine, than for other information workers such ...
    Posted Sep 27, 2015, 1:34 PM by Renato Athaydes
  • A Groovy Webserver running on Raspberry Pi in minutes I have just bought a Raspberry Pi to have some fun with code first and, hopefully, hardware later.After setting it up (with the Raspian OS, a Linux distro for the Pi), making sure it could connect to the internet and I could ssh into it from my laptop, the first thing I wanted to do was to get it to run a little webserver.I have recently attended a Java meetup (in fact, the very first one in Stockholm) where one of the speakers demoed the Spark-Java micro-framework, and it really caught my attention. Starting up a webserver and providing a simple REST API or just plain HTML with it is as easy as it gets so ...
    Posted Jan 2, 2015, 5:06 PM by Renato Athaydes
  • Creating a simple JavaFX 8 app and testing it with Automaton I have finally given Automaton 1.1 the last touches and released it, making it publicly available at Bintray's JCenter. I believe that with the newest features and bug fixes (see the release notes for a full list) Automaton has really become an awesome framework to allow anyone to thoroughly test their UIs (JavaFX, Swing or mix of both) in a very similar manner to some great UI-testing frameworks such as Selenium and Geb. In this blog post, I would like to show how to create and test a JavaFX application using pure Java code and, alternatively, using FXML (a UI-layout markup language similar to HTML) and the Scene Builder, a free designer tool which greatly eases ...
    Posted Jul 29, 2014, 2:01 PM by Renato Athaydes
  • Give your code some space! I have seen recently quite a few different coding conventions regarding the use of white spaces being used by different development teams. This has intrigued me as I have always thought that there ought to be a "best convention" for white spaces, and code format in general. In practice, this seems not to be the case. But this begs the question: why does every team, if given the option, seems to come up with different rules (or lack of rules) for what they consider to be the best use of white spaces? Status quo To start with, I would like to discuss the Java code convention used by default in most Java IDEs. Here's an example: public class Example ...
    Posted Jun 1, 2014, 10:11 AM by Renato Athaydes
Showing posts 1 - 15 of 26. View more »