I Asked GPT-4 To Refactor My Legacy Codebase

preview_player
Показать описание

Hello everybody I'm Nick and in this video I will try to get the brand new GPT-4 model to refactor a legacy codebase using ChatGPT. The old model always failed the task so let's see if the new version improved on it.

Don't forget to comment, like and subscribe :)

Social Media:

#openai #gpt4 #chatgpt
Рекомендации по теме
Комментарии
Автор

2023: Nick asking ChatGPT-N to refactor the legacy code
2027: ChatGPT-N asking Nick to refactor the legacy code to offload servers

dmitryborovych
Автор

Shows that, just like search engine skills, you still need to know what you want, and how to review good code.

neilhatly
Автор

Cool. My boss can now do the coding for our entire team. I guess I can maybe still get a job sweeping streets and painting fences, until Boston Dynamics rolls out their army of mechanical handymen.

Baekstrom
Автор

I copied the transcript into chat gpt 4 and had it summarize the video:
"In this video, Nick uses the new GPT-4 model to refactor a legacy codebase in C#. The AI model successfully refactors the code based on the given principles, such as SOLID, KISS, YAGNI, and DRY. It generates an interface, a user repository, and a validator, among other changes. The AI also helps address issues with the constructor and suggests using an IClock interface for dependency injection. The refactored code compiles successfully in the IDE. This demonstrates the potential for AI tools like GPT-4 to assist developers in refactoring legacy codebases and improving overall code quality." - chat gpt 4

eclipxs
Автор

I'm speechless. I've been programming for 40 years and had absolutely no idea that an AI could be anywhere near this good. This refactoring example was especially amusing for me since I've had trouble convincing some 'senior' colleagues about the need to inject a time dependency.

andrewlydon
Автор

impressive and terrifying at the same time. Its growth rate is insane, can't even imagine what it will be like 1 or 2 years down the road.

MrStevg
Автор

For me making games solo its a boom. Have been coding since the days of the AtariST and this is the first realy useful tool for speeding my workflow I've been excited about.

sqwert
Автор

I learned a lot about refactoring today, and I've been a coding for 30+ years. Something is amazing about this video, and it's not just ChatGPT.

thygrrr
Автор

Please keep doing these type of prompt engineering videos with GPT-4, I really enjoy them! Great work

EPK_AI_DUBS
Автор

I like where this is heading and this will be very interesting to see in couple years. I kinda feel bad for junior developers tho, since you have to know almost everything to guide it in the right directions and also to see the flaws, it has in the generated snippets.

That being said I can already see some disasters that this tool will produce.
a/ basically sharing your codebase with the engine - breaking most of security protocols in the company
b/ Dunning–Kruger effect amplified for junior devs - which can cause disasters for the company in the long run, when things start falling apart
c/ possible worse treatment by other non-dev employees in the company - but if this tool gets good enough, you can easily ditch the company and start your own, since you will be efficient like a team of 10, but without all the communication/management/cost issues.

Scroapy
Автор

Hi Nick! See you under the bridge in a couple of years!

КириллКиселев-жч
Автор

Wow, this is seriously impressive. I just keep thinking how great it will be to offload most of the grunt work. Remember, this is a "general" chat bot. Future versions coming very soon will be code specific AI toolsets integrated into IDEs and command line utils (CD/CI pipelines, etc.) that can run locally to keep code private and to learn company/domain specific information. This is such a productivity boost. Automatic refactoring, testing, PR reviews, etc... Yes, there will be some "issues" along the way, but I suspect those "issues" will be addressed very quickly. The rate that this progressing is mind blowing. Probably because of the insane productivity of the AI developers that are using their own tools. 😁

My head is swimming with all of the possibilities. I don't think it will replace devs completely, but there will be much less of us and the job itself will change quite a bit.

Beltalowda
Автор

Hi, I'm a n00b in programming like a simple Arduino for audio use, ChatGPT did give great code to develop effects in JS to use with my DAW, what I learned, you have to feed specifics into the script to get good results. Now in the past I coded databases in dBase III and IV for bookkeepers, but I forgot a lot, but I recognize the strings that are used, not in JS specific, but I used it already to code a playlist database in SQL. It's great stuff what it can do. And a good refresher for my memory. Great channel BTW.

Bluelagoonstudios
Автор

This is what I've been doing, just with more context and feeding it the most recent documentation on whatever I want to use. The expert paradox is real. I have no idea where we're going to go from here.

everythingiscoolio
Автор

I did the same and it was great. Nothing super complicated but it helped me refactor an Azure Function that was long running into a fan out/in durable orchestrator function calling activity functions. I then asked it if the system could handle 10k requests a second just for fun even though obviously that's a heavy load. It gave me a very thorough list of everything I needed to do to ensure the best scalability and performance.. bottlenecks, rate limits, db, parallelism in functions, etc. Developing with GPT-4 is a delight so far. It feels like having a teacher and a coder working for you at the same time.

dkin
Автор

4:14 Another way to refactor that is to create a seam there, a protected virtual method that internally call the static method, "Extract and Override" and when testing you can create a Testable class which overrides it and does not call anything, logs or validates depending on whether you want a stub, a spy or a mock.
For those juniors watching this video: note that the initial solution was wrong, the next one too, and that it took some time of back and forth to get with a correct one. Don't just copy without understanding.

refactorear
Автор

Learned a lot in a few minutes. can u do similar videos of refactoring please with gpt4 and ur added reasoning and explanation.

worldinstyle
Автор

-You can youse Google on this interview, you know?
-Ok, can I use GPT-4 then?
-Yes of course, that's a great idea!

Just had this interaction on an interview lmao 😂

Horesmi
Автор

The one to seems work best is "refactor according to the guidelines of the book Clean Code" (can tack on SOLID as well). Its really hard to make it really break down everything down into small methods but that one is the most efficient I found. Uncle Bob is the Greg Rutkowski of coding :) . "Write extension methods covering all if-statements" is also a good one

SomeKindOfMattias
Автор

This is absolutely amazing. I can not believe how mind-blowing this is.

As a developer (even though TypeScript), I’m really grateful for these videos where you go much more in depth with AI and programming/system design, instead of just having it make simple functions.

I’m going to hit the bell icon to get all your videos from now on. 🙏🏻

dawid_dahl
welcome to shbcf.ru