As a software test automation veteran, I know what it is to code manually for hours, and making mistakes is imminent.
Manual coding leads to human errors, and is also very time-consuming. Developers want to design a solution and build it quickly, without too much time coding.
One way to achieve this is to use Software Development Automation, or SDA for short.
This blog post will explain how to get started with SDA by using the SDA tool MetaFactory.
What is SDA?
For this blog, I define Software Development Automation as creating source code automatically by using a code generator tool.
Some examples of these tools are Hibernate Tools, MyBatis Generator, SpringFuse, Celerio, MetaFactory, etc.
Now, I’ll illustrate SDA with MetaFactory.
MetaFactory—What is it?
MetaFactory is developed by MetaFactory B.V. , a Dutch software house specializing in SDA.
MetaFactory is a desktop solution, which runs on Windows, Linux or Mac.
A developer can run it on his own computer as a plugin to the IDE he uses.
How does MetaFactory work?
The developer needs to run a number of instructions with XML, and with the use of template engines such as FreeMarker and Apache Velocity. Based on these instructions, MetaFactory promptly creates the source code you want.
Automatic updates are also possible. The developer can simply adjust the input (XML pattern or template) according to your requirements, and MetaFactory will automatically apply your changes to all the relevant lines of code. This coding can be automated by using the recurring patterns in your code.
This does not lead to redundant code because MetaFactory will add metadata to the patterns, and by using this metadata, MetaFactory can steer which code has to be generated (or not).
When do I need it?
As already mentioned, MetaFactory makes use of metadata of recurring code/patterns.
What is an example of recurring code? Well, what about code that enables a web or desktop application to connect and work with a database? This needs a lot of patterns, and MetaFactory is most suitable to automate this pattern generation.
And, using MetaFactory while refactoring is no issue because of the automatic updates through the whole code.
Who is MetaFactory for?
MetaFactory patterns are currently available for Angular (1.x and 2.0) and Java.
Clients of MetaFactory are developing C# and Python patterns for future use.
Do you have a practical example?
We will build a simple “Hello World” application with MetaFactory.cid:[email protected].
Let’s assume MetaFactory is installed on your computer.
Generate an XML file named MetaFactory.xml with the following contents:
model.xml pattern.xml snippers
Now generate an XML file in the same folder named pattern.xml with the following contents:
generated/java < parameter name=”args”> strings[ ]/datatype> < body> // just output Hello World System.out.println(“Hello World”) ;