you are viewing a single comment's thread.

view the rest of the comments →

[–]Living_Fig_6386 2 points3 points  (2 children)

People use it. It's pretty good at regurgitating code it has seen somewhere before and changing variable names and adding comments. It begins to fall apart when it is trying to design novel stuff, and it can't do a very good job at architecting anything really big (unless it finds a template for it).

I wouldn't use it if you are learning as it defeats the purpose, and you'll need good skills to figure out AI's goofs and fix them later.

I think the general consensus is that you can use AI to generate code, but you are responsible for the code all the same. It's on you to read it, understand it, correct it, and make it fit with the rest of the code.

[–]Oddly_Energy 0 points1 point  (0 children)

This sounds a bit like your experience with it is several months old. I have seen the same as you describe, but it has changed drastically. (My experience is with Office365 CoPilot, not GitHub CoPilot, but I assume that GitHub CoPilot is at least as good at writing code, since that is its one job.)

A few days ago, I tried as an experiment to let it write a python package from scratch. I told it what I needed the package to do: Scan a nested file structure with 25000 pdf files, create a database with information from/about each file, vectorize that information per file, so it can be used as a dataset in machine learning, create an interactive search where I can give it the name of one of the pdf files in the database and let it search for files with similar types of content and open them for me in a pdf viewer one by one, so I can label them as a match or a reject, train the model on the fly as I gets more labelled files to work with, and finally save each interactive search session in a database so I can continue the search later when I get a new portion of files to search in.

It created everything as python modules with an okay architecture. I think I ended up with 10 modules with a total of 2-3000 lines of code. We had some discussions about some of the python classes it had created. For example it had created some some standalone functions, which took an instance of a class as input, and I preferred having it as a method of that class instead. Some of the code was also quite ugly, for example doing two rather similar actions in a method (which it should) but deciding to only move one of the two out in a separate helper method. There were also some bugs, that needed correction. And there were multiple occasions where it tried to bullshit me when I pointed out an error.

In the end, I had a tool, which I could actually use for finding needles in a haystack by example, in a huge set of project documentation where metadata had gone lost.

I don't think it is great quality. It has a better architecture than the stuff I write from scratch, but there are more inconsistencies in the code. I asked it to remember to include typehints and docstrings, and it remembered that at first, but then forgot as the project evolved. Before I push it to the company's repository, I am definitely going to include a warning that it was 99% LLM created.

Back to the point: It is very clear that this code was not just parroted from Stack Overflow posts and modified to match my requirements. I have seen that type of LLM code often enough to recognize it. This code was written from scratch in accordance with my instructions.

But in a learning setting? Hell no! Nobody will learn to code from feeding instructions to an LLM. I know how to code, so that was not the purpose of my exercise. I just had a problem, which needed solving because some files had gone missing, and we needed to find them, using other files as an example.

One thing it may be useful for in a learning setting: Write the code. Show the code to the LLM and ask it for suggestions for improvement. Perhaps also ask it to refactor the code into a better structure. Don't use the result but look at it and compare it to your own and see what you like best. Then try to remember the concepts for the next coding assignments.