said a devops guy… My job-preservation hackles rose - “This guy has no clue how hard it is to write FE code apparently!”, I thought-screamed. But then I took a step back and wondered, how much code COULD i be generating? This stuck in my mind for months afterwards…
So I decided to research just how much code could I generate instead of write?
Here’s what I came up with (and made!):
Code generation types: (according to me)
- Snippet generators
- Sub-project generators
- Full-project generators
Snippet generators, which are found in almost every IDE, are ways to insert small chunks of code. Here are some that I use at work:
Snippets are EXTREMELY useful, especially if you learn how to make and utilize them quickly. They really speed up your development time.
The next category is sub-project generators, which is a step up from snippets in that they usually take large configurations and can generate standalone sections of code to be used in an existing project.
Example I found: https://formbuilder.online/ — A JQuery form builder
There aren’t a lot of standalone “sub-project” generators because most are baked into the next category…
These take on the responsibility of generating an ENTIRE project for you.
http://yeoman.io/ — which will actually generate an entire project, then give you component generators often, such as controllers for angular etc.
https://jasonette.com/ — a cute way to convert a JSON object into a full native app.
These are GREAT for “getting started”… but anything else starts to feel inhibiting (like JSONette).
My attempt to generate code: A “sub-project Selenium generator”
After doing all this research, I came to the conclusion: Only attempt code generation if it’s very very repetitive or you need help getting started.
So in February, I was re-writing my Selenium code AGAIN after a bunch of new features landed on our startups dashboard. I realized that this stuff was repetitive… click on element, check it exists, blah blah…
I wrote a chrome extension tool called Snaptest which outputs a Selenium test folder. The folder is then added to your existing test configuration/setup, and can be maintained and run in the tool much more easily.