Coding with AI: How AI is Changing the Way Developers Work?

Coding with generative ai

Coding with AI: How AI is Changing the Way Developers Work?

Generative AI has captured the public’s fascination, igniting a technological fervor. While many are engrossed by AI’s prowess in crafting human-like text and visual masterpieces, its coding potential is creating waves in the tech community. Imagine conversing with an AI chatbot about a desired program, and in moments, it provides you with ready-to-run code. This phenomenon both excites and unsettles many developers.

The idea of AI-powered coding has sparked bold forecasts about the software sector’s trajectory, especially among top-tier executives, industry consultants, and the analysts tracking them. But what’s the perspective of those developers and managers who interact with AI tools daily? We reached out to several individuals using generative AI for coding to gather their insights. What we learn is that AI is indeed reshaping the professional landscape, but it’s not poised to oust human developers in the foreseeable future.

How AI helps Coders

Among the generative AI platforms favored by the developers we consulted, ChatGPT from OpenAI stands out, as does GitHub Copilot, compatible with Visual Studio and various IDEs. Both platforms can craft code from human language prompts. However, Copilot, along with its advanced version, Copilot X, transcends this, functioning as an enhanced IDE autocomplete, predicting the developer’s next move.

Panickos Neophytou, the co-founder and CTO of NetBeez, frequently turns to Copilot X and ChatGPT during his coding sessions. He highlights two distinct strategies for maximizing the potential of these tools beyond mere autocomplete. Initially, he suggests a structured approach: “Clearly outline a function, detailing its specific inputs, anticipated outputs, and the associated data models, which might encompass database tables with inherent relationships,” he advises. “The AI is typically adept at discerning these relationships. Direct it to craft the code in a particular language and style. Project management tools should frame ‘tasks’ in such explicit prompts.”

Conversely, Neophytou believes that an informal, dialogue-based method can also yield valuable outcomes. In this style, he notes, “as you work on a task, you pose spontaneous questions that arise about executing certain steps. It’s akin to having a seasoned engineer beside you, offering insights and steering you towards task completion.”

Regardless of the chosen method, mastering the art of effectively prompting the AI is crucial. Shanea Leven, the founder and CEO of software firm CodeSee, shares her technique: “I employ a sequential thought process in my prompts to ascertain the right initiating verb and then fine-tune my prompt,” she says. “Selecting apt verbs and being detailed are pivotal for crafting an effective prompt.” (This emphasis on prompt crafting is precisely why prompt engineering is emerging as a sought-after skill.)

AI’s Strengths in Coding

From our discussions with developers, several use cases emerged where AI tools proved invaluable in their workflow. Here are some highlights:

Documenting from Code

Software documentation often follows a structured format, an area where AI excels. Chris Love, the founder of web consultancy Love2Dev, shares, “One of my favorite uses for ChatGPT is writing documentation [or] comments in my code. Doing this manually can be time-consuming. However, after finalizing a function, I can feed it to the AI, and within moments, I have a comprehensive documentation page. It’s fantastic!”

The Reverse: Code from Documentation

Interestingly, AI’s capabilities extend to generating code based on existing comments or documentation. 

Solutions to Solved Problems

Every developer recognizes the recurring theme of revisiting previously addressed challenges in programming. The notion of repeatedly “reinventing the wheel” can be exasperating. Jeff Wills, the engineering practice lead at Rise8, identifies this as an ideal area for AI intervention. “Imagine I’m crafting a method to determine the distance between two points on a globe,” he illustrates. “Copilot would instinctively fetch the Haversine algorithm and generate the necessary code.”

For Wills, this application of AI is especially beneficial when the alternative is incorporating a bulky library into his project. “Suppose I’m hesitant about integrating an extensive geometry library, which could make my codebase unwieldy,” he elaborates. “I might only require that specific algorithm. I’d likely draft it independently and incorporate it, or lean on ChatGPT or Copilot for assistance. This is where AI truly shines at the moment.”

Updating or Cleaning up Code

Chris Love from Love2Dev appreciates ChatGPT’s prowess in enhancing code he’s previously written. “I’ve embarked on updating older Node.js modules, which I had previously overlooked due to the extensive time required for manual coding,” he shares. “Typically, I aim to transition older promise-driven functions to utilize async/await. The latter offers a neater syntax, which wasn’t prevalent when I initially wrote the module. I also employ it to adopt contemporary syntaxes, such as destructuring and transitioning variable declarations from ‘var’ to ‘const’ and ‘let’.”

Accelerated Coding

A common sentiment among the developers we engaged with was that tools like Copilot or ChatGPT enhanced their coding speed, even if they couldn’t pinpoint the exact efficiency gain. “I genuinely believe it aids me in crafting superior code at a slightly brisker pace,” Love comments. “Quantifying the speed gain is challenging, but the difference is palpable.”

Rise8’s Wills adds, “I sense an ability to cycle through potential solutions more rapidly. This should, in theory, boost my efficiency. However, I might be exploring a broader range of solutions, so the time savings might be offset. But the quality enhancement is undeniable, given the additional iterations I can perform.”

Tips and best practices for coding with AI

Tips and Best Practices for Coding with AI

While many we interviewed praised AI tools, they were quick to note that these tools aren’t a panacea. Several challenges and limitations arise when integrating them into the coding process.

Be very Specific

The ability of AI chatbots to process natural language can be impressive, but their comprehension might not be as deep as one might assume or desire. It’s crucial to provide clear and detailed instructions to achieve optimal outcomes. Liam Edwards, CEO of Liam’s Professional Websites, points out, “As of now, ChatGPT doesn’t have visibility into the coding within third-party applications you’re utilizing.

Hence, it’s essential to furnish it with comprehensive details about any coding challenge or question you might have. For instance, a vague request like ‘Provide custom CSS to turn a button’s background white’ might yield unpredictable results. However, a more detailed prompt like ‘Generate custom CSS to set the background of a button with the class .button to white’ would yield a more precise solution tailored to my needs.”

The real transformative potential of AI will be unlocked when it can field questions about a company’s unique codebase and then execute the associated tasks. This capability would truly revolutionize the coding landscape.

Edwards believes that to truly harness the power of these tools, one must possess a solid coding background. He observes, “This highlights the fact that individuals without robust coding skills might find the process more time-consuming and the results less accurate.”

Keep it Simple

Peter Surowski, CTO at Brain Jar, a web design and development firm, finds value in AI for coding, but primarily for straightforward tasks. “I turn to AI for minor tasks, the kind you’d typically Google,” he explains. “For instance, if I need foundational code or can’t recall the syntax for a switch statement or a ternary function in a specific language, ChatGPT is my go-to. However, for more intricate tasks, it falls short. The notion that it might replace developers seems far-fetched to me.”

Shanea Leven from CodeSee observes, “At present, ChatGPT excels in providing general coding solutions but isn’t as adept at domain-specific code generation or scaffolding. Its search capabilities are commendable, but it’s somewhat constrained due to its limited context awareness.”

Yet, she remains optimistic, noting, “I anticipate enhancements in its capabilities. The real breakthrough will occur when AI can address queries related to a company’s unique codebase and execute tasks accordingly. Such advancements would be transformative for the industry.”

Thorough Testing is Imperative

The prevailing trend in software development mandates rigorous automated testing for code before its deployment. Code generated by AI is no exception. While this isn’t necessarily a downside, it might temper the expectations of those who overestimate the technology’s capabilities. Chris Love from Love2Dev emphasizes, “Every piece of code, AI-generated or not, demands thorough review and testing. Many developers have historically relied on solutions from platforms like Stack Overflow without questioning their validity. I suspect a similar trend with ChatGPT.”

A Little Tidying is Necessary

Few developers mentioned using AI-generated code verbatim. “It’s essential to verify and test the generated code,” states Neophytou from NetBeez. “Often, it requires minor tweaks rather than a complete overhaul. However, on rare occasions, the AI nails it, producing the exact code needed. Such moments are simultaneously exhilarating, rewarding, and a tad unsettling.”

Rise8’s Wills adds, “Typically, adjustments are needed to align with the style guide and ensure consistency with the existing codebase. This might involve renaming methods or slightly altering the format to maintain the illusion that the entire codebase was crafted by a single developer.”

Prioritize Security

Introducing any novel coding technique invariably presents potential vulnerabilities, and generative AI is no exception. For instance, security experts recently discovered that ChatGPT could generate references to non-existent npm packages. This opens the door for malicious actors to predict, create, and populate these packages with harmful code.

Surya Sanchez, founder of DeepIdea Lab, emphasizes the importance of running the code locally to spot errors and identify references to fictitious packages. “In such cases, we manually rework the code, offering more precise directives to focus on specific segments rather than the entire code,” Sanchez explains. He also stresses the importance of not sharing confidential information like API keys, as AI outputs might be accessible to external parties. “Our primary goal is to safeguard sensitive production-related data.”

Interestingly, the current constraints of AI might inadvertently bolster security. Love observes, “The limitations in token or prompt/response size act as a safeguard against harmful code, in my view. It compels developers to review the code in manageable segments.”

Anticipating the Future: Can AI Replace Humans?

The advent of generative AI has sparked concerns about its potential to displace numerous professions previously deemed immune to automation, including coding. While predicting the future is always fraught with uncertainty, the consensus among the developers and managers we consulted is largely one of skepticism. “While AI can write chunks of code, and that’s very impressive, it can’t implement it, turn it into a plugin, test it, fix problems. That’s what a developer does. We’re not just code writers. In fact, that’s a fairly small part of our job. And it’s the only part AI can help with,” opines Surowski from Brain Jar.

Leven from CodeSee echoes this sentiment. “While I anticipate some firms might downsize their engineering departments, I believe industry leaders will refrain from such measures. Maintaining a competitive edge and dominating their respective sectors will be their primary focus. Such companies will continue to value skilled developers. The inherent limitations of AI, such as its inability to reason, evaluate alternatives, or manage intricate tasks, mean its utility is confined, especially when crafting complex solutions. The most promising results emerge when human expertise collaborates with AI capabilities.”