This content originally appeared on Bits and Pieces - Medium and was authored by Fernando Doglio
An overview of the benefits of using an AI-assisted development workflow.
Close to the end of 2022, the development community was shaken, and whether you noticed the digital earthquake or not, you’ll want to change the way you work unless you want to be left behind in the years to come.
I’m not exaggerating, the software development landscape changed when ChatGPT was released, and it’s time for you to update your workflow.
We’re starting to see the birth of AI-assisted coding. And no, I’m not talking about things like Co-pilot, that’s a child’s toy compared to ChatGPT and other models like it.
If you’re not yet convinced this is for you, in this article I want to tell you why you should consider giving AI-assisted coding a chance.
1: You can get results much faster
Notice how I said “results” and not “solutions”.
There is a difference, as it stands right now, the first result you get from ChatGPT will not always be the final solution to your problem. In fact, 90% of the time (based on my own experience), the given code will contain bugs.
But how many times have you coded a solution from scratch on your own without any bugs?
That’s right, almost never.
You have to keep your expectations under control when using ChatGPT. It isn’t a magical solution, otherwise we’d be looking at our replacement.
Instead, it’s a faster way to write code that you can test and improve upon.
I used it to write an A* pathfinding algorithm, and I had it working in under an hour. I needed to test it and mention the problems I found to the bot, but it eventually got it right.
Maybe you can write it in less time, but I can’t, I just don’t use it often enough.
So yes, through tools like ChatGPT you can evolve a solution based on your initial input and some trial and error much faster than you would be doing it on your own, from scratch.
2: You can focus on the higher-level problems and leave the low-level details to the machine
As humans we’ve written enough for loops, there is really no reason for us to keep doing it.
You can now tell the computer to “give me some code that can return the total addition of numbers in a list and write that code in JavaScript”.
It will yield code like this (actual result from ChatGPT):
I never mentioned the for loop, in fact, I never even used the word “iterate”. This is a very declarative way of working, you only care about the end result, the actual implementation is irrelevant. You can think of this as the next level of declarative programming. We went from writing code that hides the actual implementation in pro of better understanding, to stating the result we want, and having the AI write the actual implementation.
Why is this good? Because it lets you think about the solution without losing sight of the problem. Sometimes when we’re writing a complex solution we focus so much on the implementation that we forget what we’re trying to solve or why.
This way of working lets you focus on the forest instead of a single tree, sort of speak.
3: You can work and solve problems in areas where you’re not an expert
Stemming from the previous reason, through the use of AI-assisted programming, you’re able to work on areas where you’re not an expert and still get very good results.
Imagine being a web developer with a big interest in AI, but with little to no experience working with machine learning or any other field inside AI. You know the potential that maybe genetic algorithms might have on your code, but you’ve never implemented one and you simply don’t have the time to learn enough to write your own.
Just ask ChatGPT!
For example, I’ve never in my life, implemented anything around sentiment analysis, but for this article, I’ve asked ChatGPT to write the code of a To-Do app using React.
I then asked it to:
- Add sentiment analysis to the tasks.
- Then I asked it to show a string representation instead of showing the raw values next to the task (it was showing a number).
- I then asked it to style the whole thing with Bootstrap.
And here is the final result:
It chose the colors for me, and everything worked with a copy&past, with no bugs in the code. Actually, there is one minor bug: notice how the “neutral” text is not visible. I tried to ask it to solve the problem, but the bot just wasn’t able to get the right styles there.
Probably because the model was trained with an older version of the docs for Bootstrap. That said, the fix was simple and the final result can be seen here:
The code? Sure, the code is the following:
Of all those 75 lines, I only wrote bg-secondary , that was it. And I managed to add sentiment analysis, something that I had never done before.
Did you like what you read? Consider subscribing to my FREE newsletter where I share my 2 decades’ worth of wisdom in the IT industry with everyone. Join “The Rambling of an old developer” !
4: Understanding a piece of code is easier when the AI can explain it
Copy&pasting is a very well-known technique and one that has proven to give developers a lot of great results. But how many times have we heard about someone copy&pasting a piece of code without fully understanding it and causing bugs in production that take days to fix?
It’s sadly, quite common.
With AI-assisted coding, if you need to understand code, all you have to do is ask for an explanation.
This reduces the cognitive load of having to mentally parse a potentially complex snippet to understand it. Instead, you have the benefit of an explanation in plain English, and as if that wasn’t good enough, if there are parts of the explanation you don’t understand, you can keep asking follow-up questions.
Mind you, you don’t have to take the AI’s word for it, you can compare the explanation against the actual code and validate if it makes sense. But that is still a lot easier than having to read and understand the logic behind a piece of code on your own.
5: Debugging can be easier with an AI assistant
You can use ChatGPT to debug your code, or at least, to help you do it.
For example, take this silly function:
function add(a, b) {
return a + b;
}
As JavaScript developers should know, this function will cause some serious problems if it’s not called with numbers. But if you’re dealing with a more complex function, or even if you’re just picking up JavaScript, you could ask ChatGPT what’s wrong with it, and it would tell you:
Out of the box, it’s already highlighting that if you call it with attributes that cannot be added the results will be incorrect.
It’s also able to parse it and understand it, otherwise it would not be able to tell you what might go wrong, and even more impressive, it would not be able to fix the function so those problems won’t happen.
Here is the output when I ask it to fix the function, so the highlighted problems can’t happen:
Think about it as a second brain, a digital rubber duck of sorts, one that can answer back and give you solutions.
Conclusion
ChatGPT or any other Large Language Model like it that might be released in the future is going to be part of our development workflow from now on. And if you try to avoid them, you’ll eventually fall behind the rest of the industry. Either you won’t be able to pick up new technologies like other devs, or you won’t be able to produce code at the speed they’re doing it.
Either way, this is a tool that we should all be actively exploring.
Are you using ChatGPT for your dev work already? How are you using it?
Build apps with reusable components like Lego
Bit’s open-source tool help 250,000+ devs to build apps with components.
Turn any UI, feature, or page into a reusable component — and share it across your applications. It’s easier to collaborate and build faster.
Split apps into components to make app development easier, and enjoy the best experience for the workflows you want:
→ Micro-Frontends
→ Design System
→ Code-Sharing and reuse
→ Monorepo
Learn more
- How We Build Micro Frontends
- How we Build a Component Design System
- Bit - Component driven development
- 5 Ways to Build a React Monorepo
- How to Create a Composable React App with Bit
- Sharing JavaScript Utility Functions Across Projects
Leading the Charge: 5 Reasons Why ChatGPT is the Future of Software Development was originally published in Bits and Pieces on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Bits and Pieces - Medium and was authored by Fernando Doglio
Fernando Doglio | Sciencx (2023-01-12T07:32:19+00:00) Leading the Charge: 5 Reasons Why ChatGPT is the Future of Software Development. Retrieved from https://www.scien.cx/2023/01/12/leading-the-charge-5-reasons-why-chatgpt-is-the-future-of-software-development/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.