At this point, even people living under rocks are probably aware that all things “AI” are the soup du jour of the tech world. The AI/ML revolution that’s been going on has produced some Large Language Models (LLMs), which have done some incredible things. Things like passing law school exams, completing coding interviews for six-figure jobs, and making Bing relevant, to name just a few. This is all exciting, but if you’re like me, you’re wondering what you should be doing with all this technology as a software engineer. To that end, we will take a trip to Amazon’s coding companion called Amazon CodeWhisperer.
The first question we must answer often sounds like, “I know how to write code; why should I waste my time with an AI code companion?”. Let’s discuss a few significant benefits of using a tool like CodeWhisperer.
Enhanced Productivity
CodeWhisperer has been trained on massive amounts of code. This means that when you’re trying to solve a problem, it has likely seen it, or something very similar, before and has some ideas on how to help you. What this means is that, as an engineer, you can focus on novel and creative work, fostering innovation, instead of spending time on boilerplate tasks like Googling how to center a div for the three millionth time, ultimately enabling you to solve business problems more effectively.
Turbocharged Learning
Maybe Android just added another official language, or you’re a backend engineer with a friend with a “killer app” idea who just needs someone to “code some HTML” to make it a hit. Either way, it can be daunting to pick up a new technology while still maintaining your expected level of productivity. This is a sleeper candidate for the best feature of a tool like CodeWhisperer. The tool knows the language, and you know the problem domain. So go ahead and rewrite your Android app in Kotlin, or tell your friend you’re in to help him build “Twitter, but for bipedal birds.” CodeWhisperer has your back through the struggle of learning new syntax and keywords.
Time Savings
Let’s face it, there are many what I call “knucklehead” tasks that we have to deal with in our day-to-day work. You may be writing a DTO class, calling that repository method for the 9,000th time, writing a test case, or any other relatively simple task. This is the area where CodeWhisperer starts to shine through once you’re comfortable, as the tool will chew through the annoying boilerplate almost without you having to think about it.
Now I can hear you all screaming into your screens that excellent maxim from Mr. Torvalds, “Talk is cheap; show me the code.”. I couldn’t agree more. Let’s make a quick application to demo some of the benefits. For the sake of brevity, we’ll do a short Rust program that will:
- Make a GET request to an API
- Retrieve the JSON
- Deserialize it to a struct
- Tell us how many humans are currently in outer space
Feel free to follow along in your favorite language and IDE. Currently, CodeWhisperer has the strongest support for Python, Java, JavaScript, TypeScript, and C#. It also supports code generation for Go, Rust, PHP, Ruby, Kotlin, C, C++, Shell scripting, SQL, and Scala. As for IDEs, it supports VSCode and JetBrains at the time of writing.
Prerequisites
You’ll need a supported IDE (VSCode or JetBrains) and the AWS Toolkit extension (VSCode, JetBrains) to get started. Once you’ve set that up, we’ll open it up by opening the extension menu (this will default to your left sidebar if you’re on VSCode). Expand the CodeWhisperer menu, and give Start a click.