I Asked GPT-4 To Refactor My Legacy Codebase

Поділитися
Вставка
  • Опубліковано 25 лис 2024
  • Check out my courses: dometrain.com
    Become a Patreon and get source code access: / nickchapsas
    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:
    Follow me on GitHub: bit.ly/ChapsasG...
    Follow me on Twitter: bit.ly/ChapsasT...
    Connect on LinkedIn: bit.ly/ChapsasL...
    Keep coding merch: keepcoding.shop
    #openai #gpt4 #chatgpt

КОМЕНТАРІ • 472

  • @dmitryborovych9135
    @dmitryborovych9135 Рік тому +734

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

    • @xmesaj2
      @xmesaj2 Рік тому +82

      2028: ChatGPT-N asking ChatGPT-N to refactor ChatGPT-N

    • @f220696
      @f220696 Рік тому +104

      2030: ChatGPT-N "Hello everybody I'm ChatGPT-N and in this video i wil..."

    • @almadesperado
      @almadesperado Рік тому +7

      2027 => "2024: ChatGPT-N asking Nick to refactor the legacy code to offload servers"

    • @theyspeakagain
      @theyspeakagain Рік тому +37

      2040: ChatGPT refactors Nick's genetic code

    • @sherryssj5
      @sherryssj5 Рік тому +7

      2042: ChatGPT-N refactors Nick to Nick-N and they get into an endless loop of Nick-N asking ChatGPT-N+1 to refactor code, it does, then refactors Nick-N to Nick-N+1. However Nick-N+1 will be tasked to find and decommission Nick-N who will have changed his appearance and have gone into hiding.
      Sounds like the plot for a sci fi movie. Maybe something named Bladerunner 2042?

  • @neilhatly
    @neilhatly Рік тому +302

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

    • @lemmack
      @lemmack Рік тому +57

      For now.

    • @Nnm26
      @Nnm26 Рік тому +12

      @@lemmack well said

    • @ytchannel6569
      @ytchannel6569 Рік тому

      @@lemmack For now for us.

    • @alansmithee419
      @alansmithee419 Рік тому +34

      Yes, but it is still much faster than a person could perform the task.
      Replacement is not simply about "it can do your entire job now."
      Replacement also occurs when a tool can be used by someone to produce much more work output than previously.
      If one person can use this tool to produce what used to take five people, guess what? 80% of the work force for that project just got "replaced."
      Yes, high skilled professionals are still needed in this instance to guide and monitor the AI, but many fewer of them than previously.

    • @joelv4495
      @joelv4495 Рік тому +17

      @@alansmithee419 It's funny though. For the last 40 some-odd years, we developers have become so highly-valued BECAUSE we are a force for automating away others' jobs. Now the shoe is on the other foot... 😬

  • @eclipxs6340
    @eclipxs6340 Рік тому +139

    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

    • @me-low-key
      @me-low-key Рік тому +29

      This sounds like the Obama medal meme

    • @eaudesolero5631
      @eaudesolero5631 Рік тому +9

      It is interesting that it does not note that it itself provided answers that needed revision

    • @TheOnlyGhxst
      @TheOnlyGhxst Рік тому

      @@eaudesolero5631 thats because ChatGPT is never wrong, just ask ChatGPT.

  • @Baekstrom
    @Baekstrom Рік тому +458

    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.

    • @pneumonoultramicroscopicsi4065
      @pneumonoultramicroscopicsi4065 Рік тому +15

      Your comment killed me lol

    • @badpuppy3
      @badpuppy3 Рік тому +14

      Are you not finding the future to be as great as we were promised??

    • @kingblade1419
      @kingblade1419 Рік тому +12

      They say, you will own nothing and you will be happy, Matrix? 🤔

    • @wasabinator
      @wasabinator Рік тому +16

      Well your boss will also be an AI so maybe they will be helping you sweep

    • @anderj235
      @anderj235 Рік тому +2

      @Tim Laursen, Tesla will beat Boston Dynamics to mass production of a mechanical handyman.

  • @MrStevg8
    @MrStevg8 Рік тому +148

    Sooooo 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.

    • @zolniu
      @zolniu Рік тому +44

      From what I know about language models they tend to get better guickly at the begining. But then there is a cut-off point when providing it with more and more data to learn doesn't really improve the model much.

    • @MrBoBrilO
      @MrBoBrilO Рік тому +7

      @@zolniu yeah they basically stop "learning" at some point, you can make them work quicker but that's basically it.

    • @MarkCastle
      @MarkCastle Рік тому

      Until you let it lose with money and access to cloud compute resources so that it can improve itself by which time it’s acquired the preference to acquire power as it realises that’s a vector to improvement. Sounds nuts? Read the footnote on page 53 and section 2.9 in the gpt 4 white paper openai released. Not even fiction anymore !

    • @AvenDonn
      @AvenDonn Рік тому +14

      What a time to be alive!

    • @Linkario86
      @Linkario86 Рік тому +10

      @@zolniu Yeah the curve is log(n). Plus there is the thing that it can't think for itself. And we're a long shot from that one. It can maybe act like it's thinking by itself but it's not actually doing it.
      Edit: for the emotional and easily butthurt people: the following is a very simplyfied example for the sake of explaining how AIs do not understand things, while they have deductive reasoning, and can draw the conclusion of the following example.
      I mean what this is a huge data storage that basically memorized the internet. It can tell you what 2+2 is. It can tell you why 2+2=4. But it doesn't understand it. Like a Person who just memorized that 2+2=4 because 1+1=2 and 1+1+1+1=4. For the lack of a better and still easy to understand example: If it never learned what 2*2 is, it wouldn't know the answer is 4. Even though it memorized that 1+1=2 but can't get to the solution by just doing that calculation again and put it together => 2*2. A human is capable of that, AI is not. An AGI might be. But then again, fair to say, humans aren't able to memorized the entire internet.

  • @andrewlydon7819
    @andrewlydon7819 Рік тому +10

    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.

  • @sqwert654
    @sqwert654 Рік тому +22

    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.

    • @sqwert654
      @sqwert654 Рік тому

      @Transistor Jump no need to finish my 4 player Mahjong UI for flat and VR. Then see how it goes on steam. Only single player atm with AI, but the netcode functions are in but not tested for pc.

    • @RetroDawn
      @RetroDawn Рік тому

      Agreed. I'm making new for Atari ST, even. ChatGPT was useless for ASM. I wonder if GPT4 is any better. Likely take some time before a version that can work with legacy CPUs' ASM.

  • @EPK_AI_DUBS
    @EPK_AI_DUBS Рік тому +84

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

  • @okerror1451
    @okerror1451 Рік тому +201

    you're so polite to the AI

    • @nickchapsas
      @nickchapsas  Рік тому +438

      It might be my future overlord so I have to play the long game

    • @agsystems8220
      @agsystems8220 Рік тому +27

      The AI is trained on real conversations, so the tone of your questions will actually make a difference. If you start talking in a condescending way to it it will be more likely to refer back to conversations that descended into arguments, and less likely to think about when people actually responded productively.

    • @迪奧布蘭朵-r2h
      @迪奧布蘭朵-r2h Рік тому

      😂

    • @henningtorsteinsen2169
      @henningtorsteinsen2169 Рік тому +6

      That way you treat those with less power than yourself says a lot about your character.

    • @alexandruchirita5780
      @alexandruchirita5780 Рік тому +6

      ​@@nickchapsas Maybe your long game will fail after he reads your comment. He knew your subscribers at one point in time. Beware and delete as fast as you can 😂

  • @thygrrr
    @thygrrr Рік тому +4

    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.

  • @КириллКиселев-ж6ч
    @КириллКиселев-ж6ч Рік тому +119

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

    • @nickchapsas
      @nickchapsas  Рік тому +77

      Can't wait to start my beekeeping operation

    • @mirekmiedziarek51
      @mirekmiedziarek51 Рік тому +13

      @@nickchapsas I'm afraid that beekeping will be handled by AI powered machines anyway :D

    • @niksatan
      @niksatan Рік тому +4

      It would not be so bad REFACTORING our jobs. We'll have a big party, hope it's big bridge. I for one say hello to my AI masters-

    • @attribute-4677
      @attribute-4677 Рік тому

      😂😭

    • @TheMagenAlex
      @TheMagenAlex Рік тому

      see you there, bro

  • @refactorear
    @refactorear Рік тому +3

    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.

  • @Beltalowda55
    @Beltalowda55 Рік тому +17

    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.

    • @Lethcode
      @Lethcode Рік тому

      I think there is plenty of work for software teams still but I think you will get by with less people per team.
      Still need security reviews, someone to actually read the code generated and test interactions with other projects.
      For simple programs you won't need a developer. It will be interesting when it starts consuming open api end points and you can tell it to wire up specific calls so you can just build the guts

  • @Scroapy
    @Scroapy Рік тому +30

    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.

    • @donelbaron
      @donelbaron Рік тому +3

      d/ then your and old company is not needed since there might be a lot of them

    • @Scroapy
      @Scroapy Рік тому +1

      d/ aint gonna happen... only for some very specific market segments

    • @cl1489
      @cl1489 Рік тому

      This makes it even better for junior developers, lol. They can learn faster. This is a positive, not negative.

    • @KeithOlson
      @KeithOlson Рік тому

      a/ In a corporate setting, you would *DEFINITELY* be using this in a clean room setup.
      b/ I would *NEVER* allow this to be used for anything more than a time-saving tool for senior devs. (...though I /could/ see marketing/etc. using it to put what they want into a framework that devs can understand AND ACTUALLY BLODDY IMPLEMENT.)

    • @pneumonoultramicroscopicsi4065
      @pneumonoultramicroscopicsi4065 Рік тому

      @@KeithOlson i think coding in general will eventually be replaced by natural language

  • @everythingiscoolio
    @everythingiscoolio Рік тому +6

    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.

  • @dkin860
    @dkin860 Рік тому

    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.

  • @bonzo6989
    @bonzo6989 Рік тому +4

    This tool WILL decrease demand and salaries in IT field no doubt about that. The question is when and what to do to slow it down

  • @andyt1313
    @andyt1313 Рік тому +4

    From what I understand people's inputs are digested and used as continuing training for future iterations of the model. So you are basically training chatgpt to be better.

  • @seredaom
    @seredaom Рік тому +1

    It also does a good job creating unit tests for the code. And can fix mistakes happening in runtime if you feed chatgpt with just exception. At least it did it for me on one of the programs

  • @Bluelagoonstudios
    @Bluelagoonstudios Рік тому

    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.

  • @PhaaxGames
    @PhaaxGames Рік тому +8

    Comment written by AI, because I'm lazy... (I'm amazed that it could create a working regex from the mess I gave it 🤯)
    Hey everyone! I recently used ChatGPT-4 to help me extract and format data from a messy lunch menu HTML text. I described my problem to ChatGPT-4 and it provided me with JavaScript code snippets that addressed my concerns. Throughout the process, I was able to give feedback and request improvements, and the AI was incredibly responsive.
    In the end, we created a well-structured lunch menu object from the HTML text, which included all the necessary information for each weekday. I'm truly impressed by how ChatGPT-4 made this process so much easier and efficient. It felt like having a coding buddy by my side. Can't wait to use it for more projects in the future!

  • @SomeKindOfMattias
    @SomeKindOfMattias Рік тому +4

    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

    • @nickchapsas
      @nickchapsas  Рік тому +2

      I mean, not only did it break things in small methods but it also extracted into classes

    • @SomeKindOfMattias
      @SomeKindOfMattias Рік тому +1

      @@nickchapsas Ask it to make a state machine *BOOM* all business logic in one go :)

  • @dawid_dahl
    @dawid_dahl Рік тому +10

    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. 🙏🏻

    • @batman313rd
      @batman313rd Рік тому +1

      TypeScript does a powerful language. Don't sell yourself short.

    • @yuriy5376
      @yuriy5376 Рік тому

      Not that impressive at all once try to get it to solve smth more complicated than a HelloWorld example from the official documentation or do some basic refactoring. Once it's taken off the beaten path, it makes so many mistakes and simply invents APIs that don't exist only for you to find out that the code doesn't even compile.

  • @cmilkau
    @cmilkau Рік тому +1

    For me, this is like the first time I got to interact with a computer. There's this extremely powerful and versatile tool, and you just want to see what you can achieve with it. That's what got me into coding. I don't understand the fears of "getting replaced" at all. It's not like there is nothing to do for software companies. And with these kind of tools, cost should go down, which may create even much more demand.
    I mean, in the long run probably every profession will undergo some decline, being replaced by new professions. For one, that's not around the corner in software. Two, who says we can't do those new professions? Three, that would probably be an upgrade as well.

  • @Horesmi
    @Horesmi Рік тому +4

    -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 😂

  • @ClaytonHunt
    @ClaytonHunt Рік тому +5

    This is Awesome, can't wait to unleash it on some of our legacy codebases!

    • @maxpkr
      @maxpkr Рік тому +1

      Developers who write code might become legacy

  • @tanglesites
    @tanglesites Рік тому +20

    Just wanted to add. This is the best channel on UA-cam. Without it, I would still be scouring books and the armpit of the internet trying to figure out what the "out" and "in" keywords are doing in a generic declaration. I hope ChatGPT finds a place in society without putting people on the street, and so Nick and Content Creators like can keep making content, because University is F****** expensive.

  • @worldinstyle
    @worldinstyle Рік тому +3

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

  • @AlexSchwartzATV
    @AlexSchwartzATV Рік тому +3

    It seems like you still need to know what youre doing and what to ask for, but since its doing the grunt work you can get it done much faster.

  • @carldaniel6510
    @carldaniel6510 Рік тому +3

    Nice demo! I think refactoring is one of the most straightforward and useful applications for models like GPT. While I would expect a senior developer to have been able to do this refactoring in only a few minutes, the fact is, as you pointed out, many could not, and less senior developers might never get there, even with a lot of prompting. This and the use as a more interactive form of documentation (e.g. "show me how to use the lag function in SQL") should be integrated into development environments ASAP. These kinds of tool free up congitive space in the brains of developers to actually spend their time developing, and less time going through the mechanics of typing and retyping code.

  • @MattMadgarr
    @MattMadgarr Рік тому +51

    I can't lie, I'm getting a liiiiiitle bit of anxiety from this AI, I'm an okay developer but I feel like this could probably replace me at some point, maybe already

    • @cromeromail
      @cromeromail Рік тому +1

      Then become a Chat GPT expert

    • @helmedfox9559
      @helmedfox9559 Рік тому +11

      Same here. This thought is not leaving me the whole week, since OpenAI made their live stream.
      Before this I was calming myself by saying "well, it still struggling to understand things if they are not clear enough, you still need a developer to put things together", now when I saw how it creates a website based on some 5 min sketch, I lost my peace of mind

    • @djrmarketing598
      @djrmarketing598 Рік тому

      I feel the same way as you do, I consider myself a decent system architect (taking a described business model or idea and transcribing it into a working prototype), but in the majority of the one-off prototypes I find that I'm just doing quick and dirty stuff to get it going like putting EF code right into a UI component. What I realized by watching it refactor code is often I've made "design patterns" in my code but not the standard type but my own sort of designs. ChatGPT has had me recently refactoring a lot of my code I'm making now into injectable design patterns so the "future version" (if there is one on a prototype) is a lot cleaner. Although it looks to me I can almost send my busy work to ChatGPT now.

    • @pneumonoultramicroscopicsi4065
      @pneumonoultramicroscopicsi4065 Рік тому

      @@helmedfox9559 more like 5 seconds sketch, that sketch definitely could've been better

    • @rumble1925
      @rumble1925 Рік тому +3

      It's a tool that will help you write more and better code. You should be excited you don't have to do the repetitive and boring parts anymore, you will be able to model your system and test ideas and validate them extremely fast.

  • @pedroferreira9234
    @pedroferreira9234 Рік тому +7

    I'm using GPT-4 and the moment you go to deep stuff it starts failing again even some basic stuff it fails but is better than gpt-3.5 for sure

  • @jamesmussett
    @jamesmussett Рік тому +3

    I've been playing around with GPT 4 over the past few days and I'm beyond impressed at this point. In some instances, there's still a lot of handholding that needs to be done to make it fully aware of certain performance and architectural improvements, but I'm in the process of writing a custom persona for GPT that should hopefully remedy some of it's shortcomings.

  • @ServandoPestano
    @ServandoPestano Рік тому

    It is really impressive (all about) this tool. And this is just the beginning...

  • @Mosern1977
    @Mosern1977 Рік тому +2

    Had some crazy code made by some other developer that I didn't understand, told ChatGPT 3.5 to refactor it. It confidently did, unfortunately it failed to do it correctly.
    But wonder if ChatGPT 4.0 will be able to do things like that.
    Cannot wait to it being introduced directly into Visual Studio - refactor old shitty program => bam - new program with nice comments etc.

  • @engineersbeard
    @engineersbeard Рік тому +1

    Everybody is worried about their jobs.
    All this means is that we can build bigger faster and far more complex.

  • @pilotmanpaul
    @pilotmanpaul Рік тому +2

    Looks like this will cut down tech jobs by 80%. The remaining 20% will be there to just hold its hand a bit and push/nudge it in the right way.

  • @OBGynKenobi
    @OBGynKenobi Рік тому +1

    now imagine this thing 5 years from now. Crazy!!

  • @cn-ml
    @cn-ml Рік тому +4

    I cannot understand how AI as improved so incredibly fast. This is seriously impressive and not all developers would have passed the interview as good this?

    • @ammar0466
      @ammar0466 Рік тому +1

      Ai development will be exponential too fast maybe next month gpt6

    • @victoriap1561
      @victoriap1561 Рік тому +2

      ​@@ammar0466nope, the hardware to train it hasn't evolved that fast

    • @ajp2206
      @ajp2206 Рік тому +1

      @@victoriap1561 yep. Hardware limitations are the biggest setback for AI development currently

    • @ChronicTHX
      @ChronicTHX Рік тому

      SImple, lot of electricity that is gonna start to be seen in the price of those services, and lot of computing power (cpu/graphic cards).
      Things are not getting magicaly better, there is a hardware bottleneck to this, and an energy one that no one seems to see, adding that to the societal issues (plagiarism, job destruction), privacy issues (who is the master of the data). AI is a subject that needs to be talked about on non technical pov too. WHat's the price of this for our societies ?

    • @Ovinski
      @Ovinski Рік тому +4

      @@ChronicTHX Instead of focusing on researching new technologies and medical issues like cancer etc, they are too busy replacing existing jobs for the sake of subscription money. What a failed evolution.

  • @patrickdahl937
    @patrickdahl937 Рік тому

    Love you video, imagine when it can read an entire technical document to gain domain knowledge and translate to code...

  • @AthelstanEngland
    @AthelstanEngland Рік тому

    This code is above my understanding but this is still perhaps one of my favourite videos just cos of your reactions! 😅

  • @codeforme8860
    @codeforme8860 Рік тому +2

    OMG I love this, my last 3 jobs were rescuing failed projects due to bad practice. If this could take a 2 million line project I could help so many more organisations

  • @valentinnikolov2474
    @valentinnikolov2474 Рік тому +1

    Hey Nick.
    I am junior to mid developer and can see the power of chat gpt.
    One question I got was what would be the best way to harness its power in order to advance in my career.
    Would you give me an answer or maybe a potential video idea.
    "How would you use it to advance if you were less experienced?"
    Maybe how to learn with chat gpt, how to use it in personal projects, what are the pros what are the cons... etc.

    • @chadknudson
      @chadknudson Рік тому

      I think the best way to harness the power of ChatGPT as a mid-level engineer is to use it to help you in your daily tasks and to view its results with a critical eye, in the same way you would do when conducting a code review. As you saw in the video, it isn't going to get things 100% correct and optimal each and every time. It relies on you to guide it down the path of finding the correct solution. You can ask ChatGPT to produce explanations for you which when you ask it to produce or refactor code for you so that you can use it as a learning tool. You can ask for citations for the decisions that are made and go to those source materials to learn about the underlying concepts.

  • @grant1133
    @grant1133 Рік тому +2

    Reminds me of ClearBanks interview test I done for some recruiter, who totally ghosted me after i submitted it.
    Good times

    • @nickchapsas
      @nickchapsas  Рік тому +1

      This one was the ASOS test. ClearBank might be using it too

  • @gridlocdev2023
    @gridlocdev2023 Рік тому

    This looks impressive, however I worry that with the suspected worsening performance of GPT-4 over time the results may have changed. I'd love to see another follow-up video or a short to see if it's still as good as when this video was posted!

  • @Drumstix42
    @Drumstix42 Рік тому

    So cool. This shows that have introductio intrinsic code knowledge is still important, but how awesome it can be to work with a tool to assist. I think the idea that becoming expert code reviewers is the way that these tools will evolve with developers is very true.

  • @MarkoMijuskovic
    @MarkoMijuskovic Рік тому +1

    Well,... time to switch to woodworking... always wanted to do something with wood and here is my chance...

  • @lee4547
    @lee4547 Рік тому +5

    Super simple Legacy program refactor. In a perfect world where all code works like Lego pieces and dependencies are injected this tool would eliminate the need for programmers, but that's not the world I've worked in.

  • @_FLOROID_
    @_FLOROID_ Рік тому

    If it's an interview question then GPTs responses aren't indicative of real-world performance as it has likely seen this task or similar tasks before in its training dataset.
    Often times when I actually try to use it at work it utterly fails across the board. As soon as I could find a simple solution online for a refactoring problem - it gives better answers.

  • @MaxQuagliotto
    @MaxQuagliotto Рік тому +3

    Ok this is crazy-good (and crazy-concerning). Your previous video I had doubts about ChatGPT with existing codebase but this is pretty powerful. Still, it will take a lot of time with even more complex and larger codebases which are probably even more 'poorly coded' but the progress ChatGPT has shown is very impressive.

    • @PoorlyMadeSweater
      @PoorlyMadeSweater Рік тому +4

      Also keep in mind this is ChatGPT not DeveloperGPT. It will be interesting once they train a version on some 40 years of real world code bases, quality refactors, and tons of books on the subject

    • @pneumonoultramicroscopicsi4065
      @pneumonoultramicroscopicsi4065 Рік тому

      One day all code will be well coded because it's all made by AI lmao

    • @pneumonoultramicroscopicsi4065
      @pneumonoultramicroscopicsi4065 Рік тому

      @@PoorlyMadeSweater you mean github copilot when it receives gpt4 update

    • @PoorlyMadeSweater
      @PoorlyMadeSweater Рік тому +1

      @@pneumonoultramicroscopicsi4065 Then concepts like code readability wont even be applicable, since AIs only use human languages for our sake. Maybe some day ask for a program and get a straight machine code executable back.

  • @GustyBroadcast
    @GustyBroadcast Рік тому +4

    Absolutely insane stuff! Each and every additional word that open-ai adds to chatGPT's "eyeballs" the more advanced it'll be.

    • @badpuppy3
      @badpuppy3 Рік тому +1

      Law of diminishing returns will eventually triumph.

  • @ifstatementifstatement2704
    @ifstatementifstatement2704 Рік тому

    Many question the very validity of OOP for programming in general. It was invented by a marine biologist who wanted to code a program mimicking marine life.

  • @CiaranGallagher1
    @CiaranGallagher1 Рік тому +10

    I cannot fathom how this even works.It's insane!

    • @JayVal90
      @JayVal90 Рік тому

      A few decades of helpful programming blog posts as training data really helps, combined with the highly pattern-based nature of the questions being answered (which is precisely what these generative AI's are designed to do well).

  • @LudwigvanBeethoven2
    @LudwigvanBeethoven2 Рік тому +2

    At this point I no longer believe those who say "AI does not understand"

  • @jespermattsson816
    @jespermattsson816 Рік тому +3

    Since this is a known interview question, there are probably several pages on the net explaining how to do that specific example. As such, the example and how to solve it is probably part of the training data for the AI model.
    It would be really interesting to see how it does on an example that it hasn't seen before.
    From what I have seen and tested of ChatGPT (although the older model), if you challenge it on something it quickly agrees with you, even if your challenge is actually wrong. If you do make a follow-up to this video, making it motivate its decisions (such as not correcting the spelling or "firname") would be really interesting to see.

    • @QQQQQAQQQQQ
      @QQQQQAQQQQQ Рік тому

      Exactly, you can even challenge it on things that are undeniably simple and true and it will still apologize and agree with your completely wrong suggestion.

  • @andriisnihyr6497
    @andriisnihyr6497 Рік тому

    That's pretty cool, I can see it being useful in some scenarios as a co-pilot. Still would love to see how it does with really crappy complicated code.

  • @michaelrall8142
    @michaelrall8142 Рік тому +2

    I love the expression on your face, when you look at the output and are at the point where you can see where the answer is going to - great. As a developer for 25 years this is a tool I often dreamt of, just tell it what you want to achieve, make critical questions, tell it to do some changes in the way you would like to, and stop typing all this dump code, that repeats over and over again 🙂

  • @vasilymeleshko
    @vasilymeleshko Рік тому +2

    Idea for next experiments: compare couple DirectX or OpenGL versions and try optimize source code for graphics...

  • @RedOneM
    @RedOneM Рік тому +2

    GPT-10 will be able to replace 90%+ of jobs with thought processes.
    Now once infrastructure is build around robots, there's no much what common people are able to do anymore as a job.

  • @Pedro5antos_
    @Pedro5antos_ Рік тому

    This was so interesting to watch!
    AWESOME

  • @megaman2016
    @megaman2016 Рік тому

    That credit limit check < 500 should have been put in the credit limit provider so that it can be tested

  • @watherby29
    @watherby29 Рік тому +4

    No wonder it writes good code. It learned from senior devs code. I am waiting for it to be creative before I become a plumber.

  • @BrazenNL
    @BrazenNL Рік тому

    You know what's also fun? If you get an error (at least, with Rust), you can paste the errors and it'll try again.

  • @iankynaston-richards5239
    @iankynaston-richards5239 Рік тому +1

    I've been able to get Chat GPT to fabricate large amounts of information loosely based on factual data. It was not making the occasional mistake, it was making stuff up in a very believable way.

  • @georgebeierberkeley
    @georgebeierberkeley Рік тому +1

    Uh, I'm glad I'm 59 and near the end of my career. If I were 25 I'd have serious anxiety over this. It'll take years to get as good as the machine.

  • @Nohim2YS
    @Nohim2YS Рік тому +6

    In a real world scenario, exposing a proprietary code base to ChatGPT to refactor would be a really dangerous.

    • @brijendrasai1513
      @brijendrasai1513 Рік тому

      Github copilot is about to be integrated with chatGPT
      Bye Bye easy programming money

    • @KennyomarGarcia
      @KennyomarGarcia Рік тому +1

      Makes me think, if Microsoft owns Github and TFS, also they are connected to OpenAi. What tells you everyone's code (in a repository) is not already exposed to OpenAi/ChatGPT?

    • @socalkol
      @socalkol Рік тому

      @@KennyomarGarcia user agreements/TOS i imagine

    • @alexandrgoncharov7975
      @alexandrgoncharov7975 Рік тому

      There was a breach in chatGPT search history, that exposed the history of prompts of other user, and that exposed quite a lot of NDA code base to the internet.

  • @frun
    @frun Рік тому +2

    I never imagined AI will be able to learn to program that good that fast ⏩⏩⏩ 🍾 🤖🍾

  • @XoPlanetI
    @XoPlanetI Рік тому +2

    i think i can keep my bartender job for some more time. All the best devs.

    • @nidungr3496
      @nidungr3496 Рік тому

      It's not just devs, it's every white collar career. Lawyers, artists, teachers, writers, engineers, architects, office assistants, medical doctors, sales, HR, industrial designers - all of them can and will be replaced by an AI that does their job better, faster and cheaper. Developers just happen to be replaceable by stock GPT-4 while the other sectors require some level of specialized tooling.
      This is the abrupt end of the 20th century knowledge economy, with even OpenAI predicting 40-50% unemployment within a few years (the Great Depression was 25% at worst) and most likely second order effects such as a collapse of demand for non-industrial blue collar jobs, a massive oversupply of desperate people pouring into manual jobs, bank failures due to large amounts of foreclosures, and all this will be fertile ground for political extremist takeovers or revolutions. (Don't forget that a massive economic crisis was what toppled the Weimar republic.)
      Good luck bartending, lol.

  • @Z-add
    @Z-add Рік тому +2

    Programmers can quit their jobs and become fulltime youtubers discussing chatgpt

  • @ironspider9026
    @ironspider9026 Рік тому +1

    Thats it I quite programming and pursue another career.

  • @reefhound9902
    @reefhound9902 Рік тому +2

    Don't feed it anything proprietary. AI never forgets.

  • @ulhaschaudhary5505
    @ulhaschaudhary5505 Рік тому

    Hi Nick,
    Love all your videos and I have learnt and understood things from it.
    Can you create videos on Hugging face which AI partner with AWS

  • @fishzebra
    @fishzebra Рік тому

    Thanks Nick, your channel is awesome. We need to raise our levels of abstraction as coders to speak a common language with AI.

  • @nhtdmr
    @nhtdmr Рік тому

    Excellent work. Keep creating videos how to use GPT4 in development and give us tips, tricks, commands to use and samples please.

  • @judewalker3657
    @judewalker3657 Рік тому

    Really interesting. Thanks

  • @ManeshBPandu
    @ManeshBPandu Рік тому

    Very nice way to use the AI ChatGPT... Noce job by a machine.

  • @garcipat
    @garcipat Рік тому +1

    This is a Senior interview? A professional does need to know this too...

  • @pneumonoultramicroscopicsi4065

    I'm glad i'm a medical doctor, i loved coding but i ended up choosing medecine, i kinda regretted it but now i started to think maybe I made the right choice.

    • @anonymousf7byyj
      @anonymousf7byyj Рік тому +3

      I would not get too comfy as doctor. (Unless you’re a surgeon or nurse)

    • @pneumonoultramicroscopicsi4065
      @pneumonoultramicroscopicsi4065 Рік тому

      @Anonymous i'm not a surgeon but we practice endoscopy, i tried chatgpt and bing chat with medical stuff, it's very bad at it, i guess there isn't enough data for it to master medecine, and the internet is filled with articles meant for the public which diminishes the quality of the data

  • @ShiroKage009
    @ShiroKage009 Рік тому

    An interview question is a bad idea since it probably exists on the internet already

  • @antonmartyniuk
    @antonmartyniuk Рік тому +1

    How to send an image to ChatGPT 4? I want to try and ask it to create a microservice on Net from a photo of the database schema on the whiteboard

  • @georgiosdrosinos9530
    @georgiosdrosinos9530 Рік тому

    Hey there! It would interesting if you write some tests first, and then let GPT-4 to write the code to pass them.

  • @user_ahfvppkjb
    @user_ahfvppkjb Рік тому +3

    This is absolutely amazing and really scary, we're easily replaceable now. GOOD JOB!

    • @cmilkau
      @cmilkau Рік тому +1

      Has anyone been replaced yet? The demand for software has not nearly been exhausted. For now, expect more to be done with the same people, not the same with less people

  • @eaudesolero5631
    @eaudesolero5631 Рік тому +2

    Can you simply ask it ' what are some limitations to the code you just provided me or some problems that may arise in the future?'

  • @devnami
    @devnami Рік тому

    What's your opinion on ChatGPT and it being replacing the devops jobs? Do you think that's a possibility in near future? Is it going to happen?

  • @jd31068
    @jd31068 Рік тому

    Pretty incredible

  • @grumpychocobo
    @grumpychocobo Рік тому +3

    Just makes me wonder, what happens if you gave GPT access to its own code and the ability to apply new code to itself and upgrade itself then asked it to continually iterate improvements in speed and capability? lol.

    • @cbot9302
      @cbot9302 Рік тому

      I know this comment is a few days old, but just a day or two after you said this plugins for GPT began releasing... It can now make its own code, run it, figure out what's wrong with it, and reiterate it. yeah

    • @haljohnson6947
      @haljohnson6947 Рік тому

      never do this or the world will end in 2 years.

  • @RoscaValentin
    @RoscaValentin Рік тому +1

    Does anyone stop to think that inputting your company's proprietary code into ChatGPT is a violation of your work agreement ? That your company's proprietary code might contain trade secrets that you have now made part of the public domain. That ChatGPT will use this input when the next persons asks "How do I make a [insert_company_name] clone".
    I mean, I'm all for "Fuck the billionaires and capitalistic empires", but this needs to be conscious decision.
    Just because the code is legacy in terms of design patterns or libraries used it doesn't mean that in terms of the problem domain it tackles it doesn't have a novel and ultra performant way of solving a complex problem. You might just give that away.

  • @anthonybisong6744
    @anthonybisong6744 Рік тому

    Great GPT4 video

  • @lutusp
    @lutusp Рік тому

    I realize you may already have thought of this, but a company posing a refactoring problem as an interview requirement might actually be a way for the "employer" to get free programming time from dozens of eager job candidates, after which they might "reluctantly" decide not to hire anyone, since the problem to be solved by the new hire has just been solved. Hey, just saying.

  • @Joooooooooooosh
    @Joooooooooooosh Рік тому

    That 32K token limit does not apply to chat GPT and likely won't anytime in the near future. The 32K model costs a fortune and is only available via the API.

  • @Uuunets
    @Uuunets Рік тому +1

    This is a pretty simple thing to refactor. Sometimes there are examples of such convoluted logic that you wonder if the author was insane or under heavy drugs.

    • @JayVal90
      @JayVal90 Рік тому

      The IClock interface thing just seems so incredibly wrong. Like at some point you are re-implementing every language feature using Dependency Injection.

    • @Uuunets
      @Uuunets Рік тому

      @@JayVal90 indeed, it is much easier to have a setup-teardown DateTime wrapper in that case, not cluttering the constructor.

  • @plamenstoyanov5605
    @plamenstoyanov5605 Рік тому

    Nick: How scprited this video i want to be?
    Nick: Yes

  • @Boxing_Gamer
    @Boxing_Gamer Рік тому +1

    We just need to integrate it with the IDE, and allow it to commit. Copying and pasting is waste of time.

  • @danielbrown7534
    @danielbrown7534 Рік тому

    This dude is basically interviewing chat gpt 🙆🏾 and he saying it doing good.. I doubt I'd be getting that job 😂

  • @angryktulhu
    @angryktulhu 7 місяців тому

    Any better way to do that in 2024? Better tools, prompts, etc? Especially for big codebase? I tried Aider but it really drains the money too much…

  • @MikkoRantalainen
    @MikkoRantalainen Рік тому

    I have been working as a software developer for 20 years with the same employer. Are you really telling me that this kind of stuff is considered "senior interview" nowadays? I would have expected this kind of refactoring to be required for non-senior positions already.

  • @AntiThesis10125
    @AntiThesis10125 Рік тому +2

    Any serious software engineer that understand how these n-gram models operate will never dare let it touch any production of complex piece of code or refactor any code.
    It doesn't understand code or know how to code, it is merely predicting the next word based on likelyhood after being trained from billions of lines of code from Github

  • @MrMattberry1
    @MrMattberry1 Рік тому +1

    Definitely better than version 3.5, you did have to know what you were doing to get it right, and that knowledge makes a difference. The solutions I work on have over a hundred projects in them, so bit harder to copy and paste. They also communicate between multiple api's, so bit harder to get it to help. Definitely a good tool though, can't wait for it to be available to general public.

  • @jessecalato4677
    @jessecalato4677 Рік тому

    If you can't see the legitimacy to the "fear mongering" then I don't know what to tell you. Great video outside of that comment.

  • @a_mediocre_meerkat
    @a_mediocre_meerkat Рік тому +2

    here's a funny thought that might give hope we wont die any time soon
    its more profitable for OpenAI to keep it at this state than to advance it any further.
    It can be used as a booster or advisor, help refactor and write unit tests, but we are still needed most of the time. So we have millions of developers using it on daily basis buying tokens, and they make billions.
    Now consider our nightmare scenario: Fast forward few versions, this thing becomes fully autonimous, you input your code base, write some specificiations on features, and boom - it's generated within few minutes and that's it you're done. No developers needed just a couple of Product (maybe ex developer) people.
    Much less usage, projects are done ad-hoc and they earn a lot less overall.
    It's a little like pharma companies would rather prefer keep patient sick and addicted to drugs than dead or healthy..

    • @JayVal90
      @JayVal90 Рік тому

      How is that any different from someone writing an actually intuitive framework like Wix for non-Developers to do simple jobs?

    • @a_mediocre_meerkat
      @a_mediocre_meerkat Рік тому

      @@JayVal90 wix has a pretty limited use case - that is creating a web site with limited functionality.
      software development is far broader than that.
      While I'm still not 200% convinced an LLM can actually become a real developer, it seems to be progressing that way. I really hope they have my thought in mind and do nerf it in case it becomes to good.