In this installment of the Generative AI series, we delve into the concept of “Prompt as new Source Code”. The ongoing revolution of generative AI allows one to amplify one’s task productivity by up to 30 times, depending on the nature of the tasks at hand. This transformation allows me to turn my design into code, eliminating almost the need for manual coding. The time spent typing, correcting typos, optimizing algorithms, and searching Stack Overflow to decipher perplexing errors, structuring the code hierarchy, and bypassing class deprecation among other tasks, are now compressed into one. This minimization of effort provides me with recurrent morale boosts, as I achieve significantly more in less time and more frequently; these instances are micro-productivity periods. To put it in perspective, I can simply think about it during the day, and have a series of conversations with my assistant while I commute. My assistant is always available. In addition, I gain focus time.
I don’t need to wait for a team to prove my concept. Furthermore, in my founder role, I have fewer occasions to write extensive requirement documents than I would when outsourcing developments during periods of parallelization. I just need to specify the guidelines once, and the AI works out the rest for me. Leveraging the AMASE methodology to fine-tune my AI assistant epitomizes the return on investment of my expertise. Similarly, your expertise, paired with AI, becomes a powerful asset, exponentially amplifying the return on your efforts.
Today, information technology engineering is going through a quantum leap. We will explore how structured coding is being replaced by natural language. We refer to this as prompting, which essentially denotes “well-architected and elaborated thoughts”. Prompting, so to speak, is the crystallization of something that aims to minimize the loss of information and cast-out interpretation. In this vein, “What You Read is What You Thought” becomes a tangible reality.
The Unconventional Coding Experience with AI
Although the development cycle typically commences with the design phase, this aspect will not be discussed in this article. Our focus will be directed towards the coding phase instead.
The development cycle with AI is slightly different; it resembles pair programming. Programming typically involves cycles of coding and reviews, where the code is gradually improved with each iteration. An artificial intelligence model becomes your coding partner, able to code 95% of your ideas.
In essence, AI acts as a coach and a typewriter, an expert programmer with production-level knowledge of engineering. The question may arise: “Could the AI replace me completely? What is my added value as a human?”
Forming NanoTeams: Your AI Squad Awaits
My experience leads me to conclude that working with AI is akin to integrating a new teammate. This teammate will follow your instructions exactly, so clarity is essential. If you want feedback or improvements in areas like internal security or design patterns, you must communicate these desires and potentially teach the AI how to execute them.
You will need to learn to command your digital teammate.
Each AI model operates in a distinct yet somewhat similar fashion when it comes to command execution. For instance, leveraging ChatGPT to its fullest potential can be achieved through impersonations, custom instructions, and plugins. On the other hand, Midjourney excels when engaged with a moderate level of descriptiveness and a good understanding of parameter tweaking.
A New Abstraction Layer Above Coding
What exactly is coding? In essence, coding is the act of instructing a machine to perform tasks exactly as directed. The way we’ve built programming languages is to ensure they are idempotent, repeatable, reliable, and predictable. Ultimately, coding is translated into machine language, creating a version that closely resembles human language. This is evident in modern languages like TypeScript, C#, Python, and Kotlin, where instructions or controlling statements are written in plain English, such as “for each”, “while”, “switch”, etc.
With the advent of AI, we can now streamline the stage of translating our requirements into an algorithm, and then into programming code, including structuring what will ultimately be compiled to run the program. Traditionally, we organize files to ensure the code is maintainable by a human. But what if humans no longer needed to interact with the code? What if, with each iteration, AI is the one updating the code? Do we still need to organize the code in an opinionated manner, akin to a book’s table of contents, for maintainability? Or do we merely need the code to be correctly documented for human understanding, enabling engineers to update it without causing any disruptions? Indeed, AI can also fortify the code and certify it using test cases automatically, ensuring the code does not contain regressions and complies with the requirements and expected outcomes.
To expand on this, AI can generate tests, whether they be unit tests, functional tests, or performance tests. It can also create documentation, system design assets, and infrastructure design. Given that it’s all driven by a large language model, we can code the infrastructure and generate code for “Infrastructure as Code“, extending to automated deployment in CI/CD pipelines.
To conclude this paragraph, referring to my first article in the “Generative AI series”, it is apparent that Natural Language Processing is now the new programming language expressed as prompts. The Large Language Model-based generative AI model is the essential piece of software for elaborating, structuring, and completing the input text into code that can be understood both by human engineers and digital engineers.
The New Coding Paradigm
This fresh paradigm shift heralds the advent of a new form of coding—augmented coding. Augmented coding diminishes the necessity of writing code using third and fourth-generation languages, effectively condensing two activities into one.
In this scenario, the engineer seldom intervenes in the code. There may be instances where the AI generates obsolete or buggy code, but these can often be rectified promptly in the subsequent iteration.
We currently operate in an explicit coding environment, where the input code yields the visible result on the output—this is known as Input/Output coding.
The profound shift in mindset now is that the output defines the input code. To elucidate, we first articulate how the system should behave, its structure, and the rules it must adhere to. Essentially, AI has catapulted engineers across an innovation chasm, ushering in the era of Output/Input coding.
Embracing Augmented Coding: A Shift in Engineering Dynamics
The advent of augmented coding ushers in a new workflow, enhancing the synergy between engineers and AI. Below are the core aspects of this transformation:
- Idea Expression: The augmented engineer is impelled to express ideas and goals to achieve.
- Requirement Listing: The engineer lists the requirements.
- Requirement Clarification: Clarify the requirements with AI.
- Architecture Decisions: Express the architecture decisions (including technology to use, security compliance, information risk compliance, regulatory technical standards compliance, etc.) independently, and utilize AI to select new ones.
- Coding Guidelines: Declare the coding guidelines independently and sometimes consult the AI.
- Business Logic: Define the business logic in the form of algorithms to code.
- Code Validation: Run the code to validate it works as intended. This becomes the first order of acceptance tests.
- Code Review: assess the code to ensure it complies with the engineering guidelines adopted by the company.
- Synthetic Data Generation: Use AI to generate data sets that are functionally relevant for a given scenario and a persona.
- Mockup-API Generation: Employ AI to generate API stubs that are nearly functionally complete before their full implementation.
- Test Scenario Listing: Design the different test scenarios, then consult stakeholders to gather feedback and review their completeness.
- Test Case Generation: Make AI to generate the code of test cases. The same technique applies to security tests and performance tests.
AI can even operate in an autonomous mode to perform a part of the acceptance tests, but human intervention is mandatory at certain junctures. It’s crucial to bridge results with expectations.
Hence, when uncertainties arise, increasing the level of testing is prudent, akin to taking accountability upon acceptance tests to ensure the delivered work aligns with the expected level of compliance regarding the requirements.
In the realm of critical business rules and non-functional requirements such as security, availability, accessibility, and compliance by design, these aspects are often considered second-class citizen features. Now that AI in coding facilitates the choice, these features can simply be activated by including them in your prompts to free you up more time to rigorously test their efficiency.
Certain requirements are tethered to industry rules and standards, indispensable for ensuring individual or collective safety in sectors like healthcare, aviation, automotive, or banking. The aim is not merely to test but to substantiate consistent performance. This underscores the need for a new breed of capabilities: Explainable AI and Verifiable AI. Reproducibility and consistency are imperative. However, in a system that evolves, attaining these might be challenging. Hence, in both traditional coding and a-coding, establishing a compliance control framework is essential to validate the system’s functionality against expected benchmarks.
To ease the process for you and your teams, consider breaking down the work into smaller, manageable chunks to expedite delivery—a practice akin to slicing a cake into easily consumable pieces to avoid indigestion. Herein, the role of an Architect remains crucial.
Yet, I ponder how long it will be before AI starts shouldering a significant portion of the tasks typically handled by an Architect.
Ultimately, the onus is on you to ensure everything is in order. At the end of the day, AI serves as a collaborative teammate, not a replacement.
Is AI Coding the Future of Coding?
The maxim “And is greater than or” resonates well when reflecting on the exponential growth of generative AI models, the burgeoning number of published research papers, and the observed productivity advantages over traditional coding. I discern that augmented coding is destined to be a predominant facet in the future landscape of information technology engineering.
Large Language Models, also known as LLMs, are already heralding a modern rendition of coding. The integration of AI in platforms like Android Studio or GitHub Copilot exemplifies this shift. Coding is now turbocharged, akin to transitioning from a conventional bicycle to an electric-powered one.
However, the realm of generative AI exhibits a limitation when it comes to pure invention. The term ‘invention’ here excludes ideas birthed from novel combinations of existing concepts. I am alluding to the genesis of truly nonexistent notions. It’s in this space that engineers are anticipated to contribute new code, for instance, in crafting new drivers for emerging hardware or devising new programming languages (likely domain-specific languages).
Furthermore, the quality of the generated code is often tethered to the richness of the training dataset. For instance, SwiftUI or Rust coding may encounter challenges owing to the scarcity of material on StackOverflow and the nascent stage of these languages. LLMs could be stymied by the evolution of code, like the introduction of new keywords in a programming language.
Nonetheless, if it can be written, it can be taught, and hence, it can be generated. A remedy to this quandary is to upload the latest changes in a prompt or a file, as exemplified by platforms like claude.ai and GPT Code Interpreter. Voilà, you’ve just upgraded your AI code assistant.
Lastly, the joy of coding—its essence as a form of creative expression—is something that resonates with many. The allure of competitive coding also hints at an exciting facet of the future.
Short-Term Transition: Embracing the Balance of Hybrid A-Coding
The initial step involves exploring and then embracing Generative AI embedded within your Integrated Development Environment (IDE). These tools serve as immediate and obvious accelerators, surpassing the capabilities of features like Intellisense. However, adapting to the proactive code generation while you type, whether it’s function implementation, loops, or SQL code, can hasten both typing and logic formulation.
Before the advent of ChatGPT or GPT-4, I used Tabnine, whose free version was astonishingly effective, adding value to daily coding routines. Now, we have options like GitHub Copilot or StableCode. Google took a clever step by directly embedding the AI model into the Android Studio Editor for Android app development. I invite you to delve into Studio Bot for more details on this integration.
Beware of Caveats During Your Short-Term Transition to Generative AI
Presently, coding with AI comes with limitations due to the number of input/output token generation. A token is essentially a chunk of text—either a whole word or a fragment—that the AI model can understand and analyze. This process, known as tokenization, varies between different AI models.
I view this limitation as temporary. Papers are emerging that push the token count to 1M tokens (see Scaling Transformer to 1M tokens and beyond with RMT). For instance, Claude.ai, by Anthropic, can handle 100k tokens. Fancy generating a full application documentation in one go?
Another concern is the inherent obsolescence of the older data on which these models are trained. For example, OpenAI’s models use data up to 2022, rendering any development post that date unknown to the AI. You can mitigate this limitation by providing recent context or extending the AI model through fine-tuning.
Source Code Structure
Furthermore, Generative AI models do not directly consider folder structures, which are foundational to any coding project.
Imagine, as an engineer, interacting with a chatbot crafted for coding, where natural language could reference any file in your project. You code from a high-level perspective, while the AI handles your GIT commands, manages your gitignore file, and more.
Intellectual Property Concerns
Lastly, the risk of intellectual property loss and code leakage looms, especially when your code is shared with an “AI Model as a Service”, particularly if the system employs Reinforcement Learning with Human Feedback (RLHF). Companies like OpenAI are transparent about usage and how it serves in enhancing models or crafting custom models (e.g. InstructGPT). Therefore, AI Coding Models should also undergo risk assessments.
The Next Frontier: Codeless AI and the Emergence of Autonomous Agents
These agents require only a minimal set of requirements and autonomously devise a plan along with a coding strategy to achieve your goal. They emulate human intelligence, either possessing the know-how or seeking necessary information online from official data sources, libraries to import, methods, and so on.
However, unless the task is relatively simple, these agents often falter on complex projects. Despite this, they already show significant promise.
They paint a picture of a future where, for a large part of our existing activities, coding may no longer be a necessity.
Hence, the prompt is the new code
If the code can be generated based on highly specific and clear specifications, then the next logical step is to consider your prompt as your new source code.
It means you can start storing your specifications instructions, expressed as prompt, then store the prompt in GIT.
Suddenly, Continuous Integration/Continuous Delivery (CI/CD) becomes Continuous Development/Continuous Certification (CD/CC), where the prompt enables the development of working pieces of software, which will be continuously certified by a testing agent working in adversarial mode: you continuously prove that it works as intended.
The good thing is that benefits stack up: the human specify, the AI code/deploy and the AI certify, to finish with the human using the results of the materialization of its thoughts. Finally, the AI learns along with human usage. We close the loop.
Integrating New Technology into Traditional Operating Models
AI introduces a seamless augmentation, employing the most natural form of communication—natural language, encompassing the most popular languages on Earth. It stands as the first-of-its-kind metamorphic software building block.
However, the operating model with AI isn’t novel. A generative AI model acts as an assistant, akin to a new hire, fitting seamlessly into an existing team. The workflow initiates with a stakeholder providing business requirements, while you, the lead engineer, guide the assistant engineer (i.e. your AI model) to execute the development at a rapid pace.
Alternatively, a suite of AI interactions, with the AI assuming various roles, like dev engineer, ops engineer, functional analyst, etc. can form your team. This interaction model entails externalizing the development service from the IT organization. Here, stakeholders still liaise through you, as lead engineer or architect, but you refine the specifications to the level of a fixed-price project. Once finalized, the development is entirely handed over to an autonomous agent. This scenario aligns with insourcing when the AI model is in-house, or outsourcing if the AI model is sourced as a Service, with the GPT-4 API evolving into a development service from a Third-Party Provider like OpenAI.
AI infuses innovation into a traditional model, offering stellar cost efficiency. Currently, OpenAI’s pricing for GPT-4 stands at $0.06 per 1000 input tokens and $0.12 per 1000 output tokens. Just considering code generation (excluding shifting deadlines, staffing activities, team communication, writing tasks, etc.), for 100,000 lines of code with an average of 100 tokens per line (which is extensive for standard leet code), the cost calculation is straightforward:
100,000 × 100 = 10,000,000 tokens; (10,000,000 tokens × $0.12) ÷ 1000 = $1,200. This cost equates to a mere two days of development at standard rates.
For perspective, Minecraft comprises approximately 600,000 lines of Java code. Theoretically, you could generate a Minecraft-like project for less than $10,000, including the costs of input tokens.
However, this logic is simplistic. In reality, autonomous agents undergo several iterations and corrections before devising a plan and rectifying numerous errors. The quality of your requirements directly impacts the accuracy of the generated code. Hence, mastering the art of precise and unambiguous descriptive writing becomes an indispensable skill in this new realm.
Now, you stand on the precipice of a new coding paradigm where design, algorithms, and prompting become your tools of creation, shaping a future yet to be fully understood…
This transformation sparks profound questions: How will generative AI and autonomous agents reshape the job market? Will educational institutions adapt to this augmented coding era? Is there a risk of losing the depth of engineering expertise we once relied upon?
And as we move forward, we can only wonder when quantum computing will introduce an era of instantaneous production, where words will have the power to change the world in real time.