Friday, March 18, 2016

The fish is out

nemonewThis is a project I’ve worked for several months now. It was internally called “project Nemo” (I like having internal project names) and it was about speeding up the process of generation.
In one of our regulars Development Team Meetings (DTM) somebody mentioned about an issue where generating Genexus’ Structured Data Types (SDTs) was taking too long, and how she was fighting that issue. That got me thinking that SDTs are “simple” classes definitions, I mean there’s no complex logic on finding related tables, closure, and stuff for what prolog is very good. So we started talking with Gastón about it and we thought it would be a good sample of simple template-based code generation. What does that mean? if you take a look at the generated code of an SDT it starts with a class definition, some initialization methods, property definitions, serialization methods (ToJson) and finally the rest interface with its properties. Every single SDT is generated with the same components.

So what is Nemo?

Nemo is a new generator for SDTs (for now) that uses StringTemplate technology for code generation. The generation has two parts, a “specificator” and the code generator itself.
The specificator “listens” to internal Genexus events like saving or deleting an object. If this object is an SDT, it specifies it. That specification is a serialization of every property of the SDT needed for later generation. That specification is saved as a json file which is then read by the generator, to generate (of course) the source for that SDT, it could be one or many source code files depending on the levels of an SDT.


So, “what’s in it for me?” you might say. Well, it depends on the size of your KnowledgeBase (KB) and the amount of SDTs in that KB, but we’ve seen generation times cut off by 30%, which we believe is pretty good for a start.


Right now, Nemo is turned on by default in Genexus Salto Beta 2, released last week (March 10th). Right now it’s only generating C#, Java is expected for the Beta 3 release. Also, there are other objects that can be generated by Nemo, like Domains, BusinessObjects (BCs) and that is also under the radar.
So give it a try, download the beta 2 of Genexus Salto and start taking advantage of the improvements.

No comments: