DEV Community

Cover image for AI code generation vs. coding by hand - what programming is going to look like in 202X 🤖 🤔

AI code generation vs. coding by hand - what programming is going to look like in 202X 🤖 🤔

Matija Sosic on December 11, 2023

We are working on a full-stack web framework for React & Node.js, that uses a simple configuration language to get rid of boilerplate. A number...
Collapse
 
ivanzanev profile image
Ivan Zanev

I asked ChatGPT if it can generate code entities, services and repositories for a school management system (students, curriculum, etc.). I also asked for it to generate HTML page where teachers can file a request to be hired. I added some requirements and asked for a generation of Laravel entities, services, repositories and everything required. Abstraction and continuous improvement (reworks) is also not a point - the AI can do it. The biggest problem is keeping continuity - if the AI assistant forgets the premises and constraints, you will have to start again. But it's not that big of a deal. Tell me something it can't do.

Collapse
 
matijasos profile image
Matija Sosic

Hey Ivan, thanks for joining the discussion! Sounds like you had a great experience building CRUD for your app with AI - that's one of my favorite use cases, too. Have you tried usemage.ai/?

Re what AI cannot do - it can't develop new abstractions, that never existed before (e.g., moving React from class-based components to hooks). That's one side of it - in my opinion, we don't want to freeze, e.g. React development, and stay on React 18 forever. We don't even want to stay with React as new, better/higher-level frameworks should emerge, just as React emerged after jQuery, Backbone, and others.

On the other side, and that's what I talked more about in the article, you care about the final code. Even if we assume that AI can generate everything perfectly, you still commit this code, other developers review it, and you want to be able to edit it. You need to understand it fully and be able to explain what each part does and why you implemented it the way you did. You want it to use the latest libraries/frameworks and the most up-to-date best practices.

That's why my point is that coding won't go away because of AI, however perfected it is - it will be faster and easier in some instances, but still the human is the one who holds the final responsibility for it.

Collapse
 
ivanzanev profile image
Ivan Zanev

Hi, Matija. I have never used AI before to generate a system but since reading your post I decided to try. The School Management System was the first thing that came to my mind. I just tried useimage.ai. Again, with the same test requirements. The app was generated in 1-2 minutes.

Your thinking is right about the social responsibility and authority. The AI cannot replace the fact that it is you. And there will be people who still come to you for solutions and decisions. No matter of the fact that an AI can do it, you will be expected to do it by using the AI.

However, my thinking is that the AI will reach the place where it will be an Automated Code Management solution. The example you gave about React will not be an issue since people wouldn't care about what happens underneath - the AI will upgrade and refactor as needed. Or it will re-create the system much like one of these guys that can recreate paintings.

Thread Thread
 
matijasos profile image
Matija Sosic

Now thinking about it, I think the main question do we want to be able to understand the code AI generates, or we don't care at all? I think we can't allow to have it as a black box, because that way we have no idea what AI actually did nor we can check it.

That means we want to be able to understand the code that is being generated. And to understand it easier, we probably want that code to be generated in the newer rather (e.g. React) rather than older technologies (e.g. jQuery or Backbone).

So yes, we don't need our code to be immediately using the latest version of React etc, (just like most of developers don't use it as well), but it still has to be new enough so we don't have a problem understanding it.

What was your thought about recreating paintings, that sounds interesting but I didn't get it?

Thread Thread
 
ivanzanev profile image
Ivan Zanev

The answer to the question "Do we care at all?" is "We do not care unless it breaks and then we have to call someone.". My question is whether there would be a self-correcting system. I will make the following analogy. In your home almost 100% there is a washing machine. As part of the industrial age, mechanisms were invented and utilities to automate effort. Nowadays we all have a washing machine in our homes. There is an argument that the washing machine does not do the job right but I don't know how many people will accept such an argument. The internals of the machine are not known and the machine can be repaired only by a technician. Nowadays there are washing machines hooked to an app that makes a quick diagnosis as to why the machine is not working. But there is no way that the machine can self-repair itself which is the premise of your post - that the systems we are building are not just software, but firmware and hardware and they cannot self-repaired.

But, supposedly, you don't code, just input the requirements and the AI generates the output system. If you can really capture the requirements of a system (guarantee there will not be anything hidden, additional or inexplicable to the AI), you can count on the AI to be able to regenerate the system in a way that the behavior will be the same. Such a system can be self-repairable, upgradable and no technicians will be required to maintain it - a robot.

I was saying about mavericks that can recreate a painting and it will look the same as the original. I can't say that code is a painting, but there was a saying that code is art, probably that's why I said it.

Collapse
 
srbhr profile image
Saurabh Rai

@matijasos You should have added the image of the whole code base. A small snippet really makes it look simpler.

Image description

Collapse
 
matijasos profile image
Matija Sosic

hah true! I should have added more screenshots, or stacked them one behind another :)

Collapse
 
garrrikkotua profile image
Igor Kotua

Amazing article! Looking forward for the times when Copilot like models can be easily ran locally (I think we are quite close)

Collapse
 
matijasos profile image
Matija Sosic

Thanks Igor! Yeah, exciting times :)

Collapse
 
sattineez profile image
Sattineez_SSC

I use AI for explain to me some code of other languages I don't know, to show me examples and to teach me something. I don't think it will substitute programmers/devs, because it "feeds" on what programmers/dev upload (by GitHub, stackoverflow...), it can algorithmically speaking generate new code but it won't have the creativity to generate new point of view or how to approach the problem on another way I guess

Collapse
 
infomiho profile image
Mihovil Ilakovac

I love not owning pieces of code. Good points about abstractions.

Collapse
 
matijasos profile image
Matija Sosic

Not having to write code for something is my favorite type of coding :D

Collapse
 
vincanger profile image
vincanger

It's a relief to know that the robots aren't going to take our jobs after all :)

Collapse
 
matijasos profile image
Matija Sosic

For now ... 🤖 :D

Collapse
 
srbhr profile image
Saurabh Rai

Yes, for now!

Collapse
 
martinovicdev profile image
Boris Martinovic

Great article and a really nice take on the whole "will AI replace us" situation!

Collapse
 
mickhalsband profile image
Mick

Very cool thanks for sharing!

Collapse
 
zvone187 profile image
zvone187

Definitely exiting times we live in!!

Collapse
 
valvonvorn profile image
val von vorn

202X means 2020 + 10 (latin notation) = 2030 ?

Collapse
 
matijasos profile image
Matija Sosic

hah can be :D I meant it more as a variable, e.g. some year in the near future (2025 - 2029)

Collapse
 
gulabsagevadiya profile image
Gulab Sagevadiya

Deep and clean stand on ai vs developer

Collapse
 
biplobsd profile image
Biplob Sutradhar

♥️ AI

Collapse
 
valvonvorn profile image
val von vorn

Coding by hand is hard, but coding with AI is dangerous, if we don't know what we do and why we do it. Thanks for your post!

Collapse
 
matijasos profile image
Matija Sosic

Thank you, glad you found it interesting!

Collapse
 
dragocrnjac profile image
Drago

Great article! I haven't thought about how AI will impact frameworks like WASP.

Collapse
 
leonostrez profile image
LeonOstrez

Nice article!

Collapse
 
matijasos profile image
Matija Sosic

Thanks Leon!

Collapse
 
marisogo profile image
Marine

Very exciting!

Collapse
 
cphjordan profile image
Jordan 👨‍💻

Awesome!

Collapse
 
petarcvit profile image
Petar Cvitanović

Nice one, thanks for posting!

Collapse
 
nevodavid profile image
Nevo David

Thank you for posting!

Collapse
 
matijasos profile image
Matija Sosic

Thanks Nevo, hope you find it useful :)

Collapse
 
lizotte profile image
Lizotte

Interesting, good points

Collapse
 
nardev profile image
Vedran p

really cool, didn't know this could be done as well

Collapse
 
chasm profile image
Charles F. Munat

And in the end, we will know nothing and have no skills at all except knowing how to talk to the AI. We will have finally accomplished our goal of making our species obsolete. I guess it has to happen someday. I was just hoping for a few more millennia.

I just keep thinking about that poor rat in the Skinner box, pushing that lever that sends a jolt of pleasure it its brain over and over and over again until it dies. But at least the rat didn't build the box and volunteer to test it.

I'm always up for doing things more efficiently, although damned if I can figure out why we need to do most things at all. But why does it feel like I'm being asked to train my replacement. And what's left for me after that?

Collapse
 
audi_guzz profile image
AUDI

what about AI Code Converter

Collapse
 
toddbradley profile image
Todd Bradley

So are we just giving up on TDD and going back to the 1990s?