Thursday, 18 February 2016

Object-Oriented approach to Code Generation

Code Generation is  a common way to reduce the unhealthy load of boring tasks often put on us eager code grunts. Many code generation frameworks I have seen use a template-replace-repeat approach where you write a template for how the generated code file should look and then replace certain keywords and repeat other sections to produce the specific file you want.

A problem with this approach that annoys me is that it is really difficult to know if the generated code will work or not until you compile it. You might have changed the name of one class and suddenly the generated code won’t build. To handle this issue I started a project called CodeGen that aim to be completely object-oriented so that you can benefit from type-safety all the way from template to executable code. The main user case for the generator is the Speedment software, but it can be used in a variety of projects.

Thursday, 11 February 2016

Decrease your Java IDE lagging by fine tuning JVM Garbage Collector

Ever wondered why Eclipse/Netbeans keeps pausing for a while every now an then? Especially right at the time when you want to show something in the code to your dear colleages? It feelt embarrassing and awkward, didn’t it?

I found out that most of the time the IDE pauses because of Garbage Collector execution. The subtle little element in design of JVM, which usually does great job in relieving us developers from worrying about memory consumption, and most people are just happy that it does its job well and ignore it most of the time. However, the consequences of running Garbage Collector may surprise us if we simply ignore it.