Research

We asked developers “What is your biggest concern in regards to code generation?”. The question was an open question with no pre-populated answers.

Most of the concerns were the same but in different words. We segmented the responses to the core concerns.

Code quality

The concern about code quality came up the most. There were various ways developers described what they were concerned about. Some wrote “bad code” while other responses were more specific. One recurring concern was the CSS attribute of absolute position. While designers are used to moving layers around, developers need to write responsive code. That means that developers rarely use absolute positioning. Other recurring concerns are things like “Spaghetti code” or “bloated code.”

All of these concerns are entirely reasonable. In the past, code generation tools were generating bloated, spaghetti code, with absolute positioning.

Our approach to developer-friendly code is to make sure the code we generate addresses all of these concerns. We automatically detect Flexbox instead of using absolute positioning. We run algorithms that remove redundant code to prevent bloat. We focus on code reuse. And instead of generating large blocks of code that can become “spaghetti code,” we let developers choose the specific component they want the code for right at that moment.

Refactoring

A repeating concern was the amount of time it would take to refactor the generated code. As mentioned before, developers would rather spend twice the time writing something from scratch, than to refactor generated code. The generated code can’t just be “close” to what developers would write themselves; it needs to be identical.

A common phrasing of this concern would be “it would take more time to adapt the code than to write it from scratch.”

To resolve this concern, Anima makes sure to give developers complete control of how the generated code looks like. The goal is that no refactoring is needed. The output is identical to how a developer would write if they have written it from scratch.

Adherence

Most of the product teams in organizations already have an existing codebase. No two codebases are the same in terms of coding style, libraries in use, naming conventions, and so forth.

Adhering to these code conventions is crucial for developer adoption. If the generated code is good quality but doesn’t adhere to the team coding style, either it won’t be used.

Learning curve

This concern is not specific to developers. For time-saving products, users want to be sure it won’t take more time to learn than the time to actually save.

Control

One cannot be responsible for something without having complete control over it. It makes sense that developers want control over how the code is generated if they are ever going to use it in production.

Dependencies

It’s crucial for developers that the code we generate does not have external dependencies. Dependencies are hard to follow and can get convoluted fairly quickly. To simplify and make our generated code easy to follow, Anima 4 does not have any external dependencies.