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 similar code written in Kotlin there is no semicolon at then end of a line.
This gives LLMs the ability to generate the code with correct syntax, in reality they didn't learn like the sense of human learning, instead they learned to predict and match the pattern of the desired programming language.
What makes todays Large Language Models truly an artificial intelligence is that they don't memorize the patterns instead they learn to apply the pattern when the input prompt contains specific keywords. Thus gives it the ability to match any pattern.
Templates are not something new that are invented alongside Agentic IDEs, these are preexisting practice used not only in the software development but in general in the technology area, like creating a document, or following a industry standard for invitation or poster.
Now that we have an understanding of how LLMs predict the code generation based on the input prompt, we can make use of this to guide the Agentic IDEs to write code that match our project standards.
There is an arguably famous pattern in Android, which is the implementation of the base class, the reason I mentioned arguably is that, the community is divided between whether to use it or not. Because, a Base class can be both useful and harder to maintain on the long run if not implemented properly.
Note: Base class pattern will become obsolete in a single activity Compose App.
One good example would be, lets say you want to add analytics every time a user enters the screen, in the traditional Android development pattern we used Fragments, and thus the BaseFragment which will contain a analytics logging function, which will be triggered to log the user event as the user has entered Screen A. So extending Screen A's fragment with BaseFragment will automatically log the screen transaction event. In case if you haven't had a BaseFragment then you would have to add the analytic logger on every Fragment you create, and this will introduce the maintainers complexity on the log run, when you suddenly decided to add additional details like a visit count or time.
This feels like a good example of a BaseFragment, here is a pro tip, the above mentioned use case doesn't actually belong in the BaseFragment, rather it should be inside a BaseAnalyticFragment, this way, you can enjoy the full potential of base classes without the maintainer's hell.
Lets take out Analytics example, say you are adding a new feature to your app like a simple settings screen for the app and it is an easy thing to miss out to add analytics, because you will be so focused on the core functionality of the app.
This is where Templates comes into play. Now all you need is a template of the BaseAnalytics class in a .md file and ask the Agentic IDE to use that file as a template to implement the Settings feature of the App.
By doing this you are guiding the LLM to create a new fragment that should exactly match the project standards, with analytics, this way, you don't need to worry about forgetting about analytics.
This is a short article, because, I think, this would make sense, we can see this in action. Lets see you in the next one possibly with a hands of example for Templates.
Comments
Post a Comment
Don't be a stranger! Speak your mind.