{"id":3747,"date":"2024-02-10T17:51:37","date_gmt":"2024-02-10T17:51:37","guid":{"rendered":"https:\/\/wearekiwi.agency\/?p=3747"},"modified":"2024-02-10T17:52:08","modified_gmt":"2024-02-10T17:52:08","slug":"three-types-of-ai-assisted-programmers","status":"publish","type":"post","link":"https:\/\/wearekiwi.agency\/es\/three-types-of-ai-assisted-programmers\/","title":{"rendered":"Tres tipos de programadores asistidos por inteligencia artificial"},"content":{"rendered":"<p>Large language models (LLM) like ChatGPT write very convincing code snippets. Early in 2023, this discovery caused a lot of premature celebration among LinkedIn influencers: no longer was there any need for seasoned developers with their gatekept expertise, fastidious attitudes, and inconveniently high salaries. Now anyone with an Internet connection could ask an AI model to write the next big social media app, in JavaScript please, and throw in some blockchain while you\u2019re at it.<\/p>\n\n\n\n<p>The promised wave of apps built entirely by AI never materialized. I\u2019m trying my best not to gloat about it.<\/p>\n\n\n\n<p>Still, there\u2019s a compelling case for AI as a programming tool. Code is a computer-oriented language. It has a small, unambiguous vocabulary and unbreakable syntax rules. Patterns and repetition are its bread and butter. It\u2019s predictable to a fault, which is why computers (and some humans, like myself) are so compatible with it. If anyone could write good code, it would be a computer. And if generative AI\u2019s greatest strength is its ability to model and imitate patterns, forming a fluid interface between humans and machines\u2014<a href=\"https:\/\/stackoverflow.blog\/2023\/05\/01\/ai-isnt-the-app-its-the-ui\/\" target=\"_blank\" rel=\"noopener\">as I\u2019ve previously argued<\/a>\u2014wouldn\u2019t programming be the ideal use case for it?<\/p>\n\n\n\n<p>Well, yes and no. AI-powered programming tools have made a splash in the programming world, and they\u2019re probably not leaving anytime soon. But despite having arrived for junior, mid-level, and senior engineers all at once, not to mention people who don\u2019t know a struct from a hole in the wall, the risk\/benefit calculation couldn\u2019t be more different depending on your level of experience. AI could be the tool that fast-tracks your career or it could be the obstacle that derails it. What matters isn\u2019t just&nbsp;<em>whether<\/em>&nbsp;you use it, but&nbsp;<em>how<\/em>.<\/p>\n\n\n\n<p>Let\u2019s take a look at what AI means for developers (and non-developers) at every stage.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">The no-code entrepreneur<\/h2>\n\n\n\n<p>Many people\u2019s first taste of programming came this year in the form of a ChatGPT conversation. It\u2019s a seductive experience: you can ask it to write an application in any major programming language and it will spit out code right up to the token limit\u2014more than enough space for the typical \u201ctutorial-sized\u201d app. From there, you can ask for tweaks and bugfixes until you\u2019re satisfied with the output. And when you paste it into an IDE and it actually&nbsp;<em>works<\/em>, it feels like you\u2019ve cracked the industry wide open.<\/p>\n\n\n\n<p>The reason for this rosy first impression is that the problems are hidden under the surface. AI tools are trained on code from thousands of real projects with disparate levels of quality and completeness\u2014that is, code that almost always runs and usually gets the job done, but is only occasionally reliable, maintainable, secure, or bug-free.<\/p>\n\n\n\n<p>Studies have found that tools like ChatGPT, GitHub Copilot, and Amazon CodeWhisperer deliver code that is \u201cvalid\u201d (runs without errors)&nbsp;<a href=\"https:\/\/arxiv.org\/pdf\/2304.10778.pdf\" target=\"_blank\" rel=\"noopener\">about 90% of the time<\/a>, passes an average of 30% to 65% of unit tests, and is \u201csecure\u201d&nbsp;<a href=\"https:\/\/arxiv.org\/pdf\/2108.09293.pdf\" target=\"_blank\" rel=\"noopener\">about 60% of the time<\/a>. Note that these studies rely on well-written prompts created by engineers. Insignificant changes to the wording of a prompt can result in&nbsp;<a href=\"https:\/\/arxiv.org\/pdf\/2302.00438.pdf\" target=\"_blank\" rel=\"noopener\">significant differences<\/a>&nbsp;to the code output. And they only test the AI\u2019s ability to output \u201csnippets\u201d\u2014small pieces of straightforward code. There is no data on AI\u2019s ability to write applications as complex as the average legacy app. It\u2019s probably unable to do so at all, just as ChatGPT is unable to write a coherent novel.<\/p>\n\n\n\n<p><strong>So where does AI fit for people who can\u2019t code?<\/strong><\/p>\n\n\n\n<p>Some would say it doesn\u2019t. The idea of AI-dependent programming ruffles a lot of feathers in the software community. A programmer is someone who knows how to code. How can you call yourself a programmer if you can\u2019t even write an&nbsp;if&nbsp;statement? But this misses the point. As only a programmer would need to be reminded,&nbsp;if&nbsp;statements (like all programming logic) aren\u2019t an asset, they\u2019re a liability. The best code is&nbsp;<a href=\"https:\/\/github.com\/kelseyhightower\/nocode\" target=\"_blank\" rel=\"noopener\">no code at all<\/a>, and second best is the minimum amount of code that solves the user\u2019s problem. If it were possible to build high-quality apps without writing a single line of code, there wouldn\u2019t be anything wrong with that.<\/p>\n\n\n\n<p>Unfortunately, it isn\u2019t, and probably won\u2019t ever be. Code, as a category, is nothing more and nothing less than being ridiculously specific about what you want. If your AI prompts are detailed enough to produce exactly the right code, you&nbsp;<em>are<\/em>&nbsp;coding in every way that matters. However, AI is non-deterministic; it doesn\u2019t always produce the same output from a given input. There\u2019s an element of randomness. So even prompts that qualify as code are&nbsp;<em>unpredictable<\/em>&nbsp;code, and unpredictability is the last thing you want after spending hours or weeks or months figuring out the minute details of a process. Anyone who spends time coding via AI prompts will eventually come to wish for something more direct, something more structured, something they can rely on to behave the same way at all times\u2014they\u2019ll wish for programming languages and compilers.<\/p>\n\n\n\n<p>I predict AI will become a gateway drug for some future programmers. But there\u2019s another, more important niche it can fill, and it\u2019s one that\u2019s easy to overlook.<\/p>\n\n\n\n<p>There are many situations where software isn\u2019t needed, but code is. Professionals in other fields already use AI to write one-off SQL queries and VBA macros. It could also be used to create app prototypes for pitch decks, proof-of-concept workflows on the command line, or disposable data-scraping bots. If you need software, you\u2019ll have to work with a software professional. But if you just need a bit of short-lived code and are willing to deal with rough edges, there\u2019s nothing wrong with shaking the AI and seeing what falls out.<\/p>\n\n\n\n<p>Ultimately, this can only lead to more work for programmers. As AI bridges the gap between vision and first draft, early-stage software companies will proliferate, and any startup that goes to market will discover (sometimes very urgently) that they need engineers on staff. But for some of them, especially the ones that started out with fewer connections and less money, the fact they\u2019re able to reach that point at all will mean AI has done its job.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">The junior engineer<\/h2>\n\n\n\n<p>New programmers have the most to lose\u2014and, in equal measure, the most to gain\u2014from AI tools.<\/p>\n\n\n\n<p>Practically every junior developer feels overwhelmed at their first job. It\u2019s like moving to Spain after a year of Duolingo lessons: it\u2019ll be at least a few months, probably a lot longer, before you have a clue what\u2019s going on. Real-world applications aren\u2019t like the compilers you wrote during your senior year of college or the showcase projects you worked on at programming bootcamp. The depth and complexity are a hundred times greater, and the standards are higher\u2014it can feel impossible to keep track of all the rules that will get you past a senior dev\u2019s PR reviews.<\/p>\n\n\n\n<p>All of this considered, it must be incredibly tempting for junior devs to pull up ChatGPT and see if it can take some of the pressure off. And for a little while they may get away with it. AI tools (as discussed earlier) are pretty good at the bare minimum, which is a lot better than nothing. And more importantly, they never respond with a blank page and a blinking cursor.<\/p>\n\n\n\n<p>But eventually it will be time to pay the piper. This is the greatest risk around AI code tools: developers who rely on them may never&nbsp;<em>become<\/em>&nbsp;good. If a developer habitually uses a code generator and relies on external feedback loops (PR reviews, integration tests, bug reports, etc.) to find problems, they\u2019ll never understand their own code. This will backfire, and it will be embarrassing. There are critical bugs, attack vectors, technical debt, and other problems in every production app that can only be fixed by someone who has a thorough and correct understanding of the code.<\/p>\n\n\n\n<p>The safest route for a junior developer is to stay away from AI tools. But it\u2019s not the only good route. If you use AI to&nbsp;<em>gain<\/em>&nbsp;understanding instead of circumventing it, it doesn\u2019t have to hold you back.<\/p>\n\n\n\n<p>For example, say you\u2019ve just finished writing a function and you\u2019re feeling uncertain about it. You\u2019ve read through it a couple times and fixed some formatting issues, but you still feel like it\u2019s not quite as efficient or idiomatic as it could be. Before you message a teammate or submit a PR, you could use AI to get another perspective: tell the AI what you\u2019re trying to do, ask it to write a function, and compare its code with yours.<\/p>\n\n\n\n<p>Keep in mind that generative AI is, by constraint, as mediocre as possible. You can\u2019t trust the output. The purpose of this exercise isn\u2019t to give you better code for free, it\u2019s to help you critique yourself. Maybe the AI used a standard method you forgot about, and it would help express your intent better. Maybe it was able to iterate your data set with a single loop instead of two nested ones. Maybe it didn\u2019t give you anything interesting or new; in that case, you probably didn\u2019t miss anything too obvious.<\/p>\n\n\n\n<p>You could also use AI to generate examples of syntax or patterns you\u2019re struggling to understand. If you\u2019re confused by null-coalescing operators, you could ask it to generate examples of their use in context. It won\u2019t generate high-quality code, but you need quantity, not quality. Repetition is the key to learning. If you\u2019ve been reading about the&nbsp;<a href=\"https:\/\/refactoring.guru\/design-patterns\/adapter\" target=\"_blank\" rel=\"noopener\">adapter pattern<\/a>&nbsp;and can\u2019t find an example of what it looks like in Dart, you can ask for a demonstration. The result may only be mediocre but it will be specific, which is what\u2019s valuable here.<\/p>\n\n\n\n<p>Whenever possible, you\u2019ll still want to learn from official documentation, hand-written code, programming blogs, and Stack Overflow answers. There\u2019s always a risk of AI saying something completely wrong. But if a snippet of subpar, made-to-order code would be enough to get you to the next step, AI can be a good resource.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">The senior engineer<\/h2>\n\n\n\n<p>SEO increases traffic.<\/p>\n\n\n\n<p>As a senior engineer, you won\u2019t feel the same temptation to use AI as a replacement for fundamental skills. You already have those skills. Maybe you won\u2019t feel inclined to use it at all, and that\u2019s completely fine\u2014you\u2019re never wrong for deciding not to use a particular tool.<\/p>\n\n\n\n<p>Some people wonder what purpose generative AI can possibly serve for an experienced dev. Half the time it spits out junk, half the time it writes something serviceable but not as good as you\u2019d write on your own. Why delegate your job to something that\u2019s objectively worse at it? To answer that question, it may help to clarify the boundary between yourself and AI. At its best, AI-written code only has about a 50\/50 chance of doing what it\u2019s supposed to, and hardly any chance of accurately expressing its place in the context of an application. You\u2019re right: AI is not \u201cgood\u201d at writing code. However, it is very, very fast. That\u2019s the expectation you should have.&nbsp;<strong>It\u2019s the AI\u2019s job to be fast, but it\u2019s your job to be good.<\/strong><\/p>\n\n\n\n<p>Editing and refactoring a piece of code is usually (not always) faster than writing it from scratch. I participated in the beta of GitHub Copilot, using it for contract work on my personal computer, and found that it noticeably increased my development speed. It did nothing for the correctness or maintainability of my code, of course. That was never its job. But by giving me something I could use (with substantial revision) about half the time, it saved a lot of keystrokes overall. Saving time isn\u2019t so great if you\u2019re getting paid by the hour, like I was. But if you\u2019re salaried, it can enable you to spend less time writing boilerplate and more time focused on development processes, code quality, documentation, or any of the other things that make your software sustainable.<\/p>\n\n\n\n<p>The pitfall to avoid here is using AI to increase velocity: delivering&nbsp;<em>more<\/em>&nbsp;features instead of better ones. Velocity is an imaginary, unreliable metric even on the best of teams; humans just aren\u2019t that consistent. And AI is even less so. If you allow expectations to form around your development speed with an AI tool, you\u2019ll find it can\u2019t keep the pace. There are some types of tasks where it excels, but others where it can\u2019t code itself out of a paper bag. It\u2019ll usually give you a boost, but often you\u2019ll be left to figure things out on your own.<\/p>\n\n\n\n<p>Again, this is a question of boundaries. AI is all about speed. If you reinvest the time it saves in more speed, instead of higher quality, you\u2019re squandering your own value as a developer. AI knows how to save time.&nbsp;<em>You<\/em>&nbsp;know how to architect and build great applications.<\/p>\n\n\n\n<p>AI can also be helpful when you need to cross into unfamiliar programming territory. At my day job I write SQL, C#, and TypeScript, but on occasion I\u2019ve had to write snippets of Groovy, MDX, or KQL. The spin-up time for an unfamiliar language is at least a couple of days, but it\u2019s all syntax. Like most senior devs, I can recognize good code by heuristic\u2014the language is less important than the structure\u2014but it still takes time to figure out how to declare a constant or iterate an array correctly. For occasions when you\u2019re outside your wheelhouse, AI can get you there faster. A quick generated snippet may be all you need if it\u2019s throwaway code. And if it\u2019s not, you can spend a little time polishing it up and still come out ahead.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">The future of programming with AI<\/h2>\n\n\n\n<p>It\u2019s often argued that generative AI is only in its infancy and will improve by leaps and bounds as time goes on. But the burden of proof on that idea is very heavy. According to&nbsp;<a href=\"https:\/\/nonint.com\/2023\/06\/10\/the-it-in-ai-models-is-the-dataset\/\" target=\"_blank\" rel=\"noopener\">one OpenAI engineer<\/a>, LLMs are little more than an approximation of their dataset. And for that dataset\u2014the Internet as a whole\u2014the most we can hope for is that it won\u2019t get worse. With the web\u2019s current incentive structure (SEO, content marketing, spam, and advertising) it seems very unlikely it will get better.<\/p>\n\n\n\n<p>My favorite definition of programming is \u201cteaching computers to make the same mistakes as humans.\u201d Nowhere is this more literally true than in generative AI. It\u2019s trained almost entirely&nbsp;<em>on<\/em>&nbsp;our mistakes. And as long as we keep writing open-source code for it to scrape, Copilot and CodeWhisperer will keep recycling our mistakes, converging toward the point of perfect, Platonic mediocrity. AI will become the most average programmer in the universe, albeit one that types a thousand words per minute.<\/p>\n\n\n\n<p>Some of you wouldn\u2019t hire a mediocre programmer no matter how fast and cheap they are. I have no argument with that. But if a firehose of mid-quality code could fit into your process somewhere, and you\u2019re wary of the pitfalls, AI can be a great tool to have in your team\u2019s toolbelt.<\/p>","protected":false},"excerpt":{"rendered":"<p>Lo que importa no es solo si lo usas, sino c\u00f3mo lo haces<\/p>","protected":false},"author":2,"featured_media":3748,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[10,6],"tags":[],"class_list":["post-3747","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-development"],"_links":{"self":[{"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/posts\/3747"}],"collection":[{"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/comments?post=3747"}],"version-history":[{"count":2,"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/posts\/3747\/revisions"}],"predecessor-version":[{"id":3791,"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/posts\/3747\/revisions\/3791"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/media\/3748"}],"wp:attachment":[{"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/media?parent=3747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/categories?post=3747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wearekiwi.agency\/es\/wp-json\/wp\/v2\/tags?post=3747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}