Skip to main content

Formatting or Linting - Helps a lot in AI Assisted development - Vibe Coding

 I'm from Android background - but that doesn't really matter anymore since the "invention" of Vibe Coding.

So, In my previous post, I have briefly touch based about AI Assisted Development - Vibe Coding, if you missed it do checkout at : AI Assisted Development - Vibe coding is good, when done right

Now why I choose this title, Vibe coding is good when done right, because, when you are vibe coding with the Agentic IDEs, it generates more code in a spawn of minutes then a human can process. We are already seeing these Agentic IDEs, develop an operating system from scratch over night. In reality it would take about more than month, so the amount of code that is being written is larger than the amount code we can safely accept and understand.

This is one of the concerns of Vibe coding, some talk about all the time and some doesn't care at all, and shows their app running localhost. But as a sensible developer like some, I'm also going to take advantage of these AI assisted development tools, and address the review bottle neck, that is what we will be seeing in the next couple of posts.

The review bottleneck

At some point, most of us have tried out the infamous learning application stack, like a todo app, an expense tracker app or even more sophisticated calories tracker app with rich UI. We do this in the inception of software development journey. If you are someone who haven't tried out, that's fine, I'm sure there is also one or two unreleased project in your GitHub or on an old laptop that is been long forgotten.

Now remember the learning we gained over the development of those home cooked applications? Well, those gave us the building blocks that you have to put together to make a successful product.

When developing those learning projects, you used to write every line of code by hand, even when you are stuck on a complex problem and comes across the solution mostly on StackOverflow,  you are always advised to get an understanding of the code and implement it by yourself instead of just copy pasting, that way you not only understand the code but gains the confidence, this will not break and if does,  this could be the reason.

Time travel to present day!

The same todo app that you spent hours on perfecting, will only take about an hour at most!

You run the app and you test the positive flows, voila, everything works without a sweat, But, here comes the real bottleneck, If we can somehow measure the vibe coding in metrics, say something like number of lines written per hour. 

Then the same  todo app you have perfected over hours vs vibe coded one, it would be something like, the AI assisted development will always win by a large margin.

Now how can we address this?

Formatting And Linting:

Formatting and linting are two different things, to simply put, formatting is just making sure that the length of a line is only 120 char max, whereas linting helps us in finding code smells, like a functions name is too complex.

If you don't already know this: LLMs - AI models are perfectly capable of generating a well formatted code and reduced to none code smells. 

Yet here we are to talk about that, because if there is one thing I learned about LLMs is that they are nothing but giant token prediction black box, and there is this famous saying, Garbage in, Garbage out. So if the code it predicts next in the sequence somehow "triggers" a weight that has a garbage in, then your output will be garbage. 

Luckily now a days they are perfecting with lots of regression and improved dataset practice, still the real problem hasn't been addressed.

Now the actual solve... How to?

Well, like the rule we have with stack overflow answers - don't copy paste, the general rule of thumb for AI assisted development is don't accept the code blindly, but-I know we are being recursive here- since the amount of code it generates are vast, it is hard to review every single line of code.

Setup the formatting and linting tool along side your codebase.

Because a static code analysis is much more efficient than a predictive analysis (see what I did here). 

And for Android I would suggest to setup detekt, which helps you detect code smells, you can customize the rules also. Suggest me some of them you use, for JavaScript and python

And the good thing here is we can run this from terminal itself, and if one thing these AI assisted development loves is nothing more than a plugin or tools that can be accessed via CLI.

Once you happily accepted a huge diff, ask your agent to run the static code analysis on the diff and fix the high priority ones. <- this is all you need to do!

Check out the next article in this series - Scripting - an underrated tool that can improve vibe coded project standards

Comments

Popular posts from this blog

Unit Tests can help AI Assisted Development from code breaks

Code Breaks are the unspoken enemy of the Software Development Cycle. When you are writing code for a new feature there is a chance you might break an existing working functionality. Well, this can often come from code smells, remember Formatting and Linting, in that article we briefly touch based about about code smells. The irony here is, code breaks can sometimes introduced because of fixing code smells, lets look at an example, say, you want to ask the user for feedback after they tried a feature for certain number of times. For that you may put a number in constant as "ASK_FEEDBACK_AFTER_COUNT" so here this constant means, you have to ask the user about feedback after X count, the count is tracked as either as an action the user performs or the page transition. Now, you add a new feature, and here you can the user's feedback after a different count, lets say after 10 action, so instead of introducing a new variable, you edit the previous one. This is where the code b...

Templates gives a guidance to AI Assisted Development tools when generating code - Vibe Coding

Templates are a useful pattern holders that guide Agentic IDEs on how to structure the output. If I know one thing, that, LLMs, AIs are getting increasingly good at following instruction or pattern. Say, you give it a passage or a paragraph, with some extra spacing and indention, and ask the AI agent to follow the same spacing and indention, and create a new paragraph, at most it can maintain the same, after all that is how they learn about everything. Now, look at this from programming perspective, there are number of programming languages available, and each one of the has its own unique syntax, like a line in Java must end with a semicolon whereas in Kotlin we don't have to worry about that.  The key idea here is, Large Language Models, at the time of training were fed enormous amount of data to learn the pattern, and they identify them, in the above case, every time they see a Java code they "learn" there is a semicolon at the end of the line, but when they see a simi...