I Asked GPT-4 To Refactor My Legacy Codebase

Поделиться
HTML-код
  • Опубликовано: 15 мар 2023
  • 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/ChapsasGitHub
    Follow me on Twitter: bit.ly/ChapsasTwitter
    Connect on LinkedIn: bit.ly/ChapsasLinkedIn
    Keep coding merch: keepcoding.shop
    #openai #gpt4 #chatgpt

Комментарии • 477

  • @dmitryborovych9135
    @dmitryborovych9135 Год назад +736

    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 Год назад +105

      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 Год назад +36

      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?

  • @Baekstrom
    @Baekstrom Год назад +457

    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 Год назад +15

      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.

  • @neilhatly
    @neilhatly Год назад +301

    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 Год назад +30

      This sounds like the Obama medal meme

    • @eaudesolero5631
      @eaudesolero5631 Год назад +10

      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.

  • @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.

  • @MrStevg8
    @MrStevg8 Год назад +149

    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 Год назад +43

      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 !

    • @asedtf
      @asedtf Год назад +14

      What a time to be alive!

    • @Linkario86
      @Linkario86 Год назад +9

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

  • @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 Год назад +200

    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 Год назад +26

      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.

    • @user-tz8ij8ht9b
      @user-tz8ij8ht9b Год назад

      😂

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

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

  • @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.

  • @user-oo7yg8em6e
    @user-oo7yg8em6e Год назад +118

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

    • @nickchapsas
      @nickchapsas  Год назад +76

      Can't wait to start my beekeeping operation

    • @mirekmiedziarek51
      @mirekmiedziarek51 Год назад +12

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

  • @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.

  • @sqwert654
    @sqwert654 Год назад +21

    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.

  • @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.

  • @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

  • @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 :)

  • @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.

  • @Pedro5antos_
    @Pedro5antos_ Год назад

    This was so interesting to watch!
    AWESOME

  • @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.

  • @dawid_dahl
    @dawid_dahl Год назад +9

    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.

  • @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

  • @Scroapy
    @Scroapy Год назад +31

    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

  • @tanglesites
    @tanglesites Год назад +21

    Just wanted to add. This is the best channel on RUclips. 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.

  • @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.

  • @derkin860
    @derkin860 Год назад

    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

  • @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

  • @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.

  • @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.

  • @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.

    • @jrcscomputing4618
      @jrcscomputing4618 10 месяцев назад

      Refactoring that code though was not a simple task. It isn't just breaking it out into new methods.

  • @ServandoPestano
    @ServandoPestano Год назад

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

  • @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.

  • @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.

  • @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.

  • @judewalker3657
    @judewalker3657 Год назад

    Really interesting. Thanks

  • @patrickdahl937
    @patrickdahl937 Год назад

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

  • @AthelstanEngland
    @AthelstanEngland 7 месяцев назад

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

  • @OBGynKenobi
    @OBGynKenobi Год назад +1

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

  • @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

  • @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 🙂

  • @gridlocdev2023
    @gridlocdev2023 7 месяцев назад

    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!

  • @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.

  • @ref_softwaredevelopment5298
    @ref_softwaredevelopment5298 10 месяцев назад

    LOL. "Do this to pass the interview". I say those things and interviewers think I'm talking bs that isn't important for just "getting things done" and I'm passed over.

  • @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.

    • @needsloomis7164
      @needsloomis7164 Год назад +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 Год назад

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

    • @needsloomis7164
      @needsloomis7164 Год назад +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.

  • @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!

  • @nihatdemir2000
    @nihatdemir2000 Год назад

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

  • @jd31068
    @jd31068 Год назад

    Pretty incredible

  • @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.

  • @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 ?

    • @tygerovi
      @tygerovi Год назад +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.

  • @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

  • @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.

  • @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.

  • @xybersurfer
    @xybersurfer Год назад

    that was pretty interesting, it still needs some hand holding, but it does most of the work. i wonder if those little bugs can be avoided. 9:36 try to be careful using suggestive words like "But"

  • @anthonybisong6744
    @anthonybisong6744 Год назад

    Great GPT4 video

  • @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.

  • @vasilymeleshko
    @vasilymeleshko Год назад +2

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

  • @IElial
    @IElial Год назад

    What about knowledge of this test interview from GPT model ? (I mean it might be scraped for its data base learning ?) Or something kinda similar (We can think this interview code follow a similar pattern to another scraped data) ?
    It would be hard to know exactly what datas have fed GPT, but can't we imagine an very unusual code base (something it is very unlikely to have learnt) to refactor instead ?

  • @babyfox205
    @babyfox205 Год назад

    How long is the context window you use, 32k? What is the maximum possible length of a coherent codebase that it can work with? I assume 32k tokens is the max it can operate with?

  • @ihatethesensors
    @ihatethesensors Год назад

    That was great my reaction was about the same.

  • @_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.

  • @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

  • @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

  • @aveekbiswas2176
    @aveekbiswas2176 Год назад

    Can we give multiple files at once or an entire project to ChatGPT to review/refactor? Or is the only way to do that is by copy-pasting code snippets to the ChatGPT console?

  • @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).

  • @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.

  • @megaman2016
    @megaman2016 Год назад

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

  • @MattMadgarr
    @MattMadgarr Год назад +52

    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 Год назад +12

      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 Год назад +1

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

  • @Amitkumar-dv1kk
    @Amitkumar-dv1kk Год назад

    How would it perform in competitive coding, like that on the leetcode, they tend to involve complex thinking processes in order to solve them, that would give an estimate of how much thinking does gpt4 actually does.
    Now i can't test it out myself because I don't have plus membership neither do I wish to, because I don't have it's use right now.
    chatGPT would fail horribly I know, it had failed for the very trivial of the coding problems for me, so I just want to see how gpt4 would perform.

  • @gavrihak
    @gavrihak 9 месяцев назад

    Thanks Nick!
    How can I ask gpt4 to refactor all my code and not just the pieces I paste to him? Is there a way to allow him to study my entire repository?

  • @user_ahfvjjfb
    @user_ahfvjjfb Год назад +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

  • @muttley4989
    @muttley4989 Год назад

    Is this code available to download?
    Both pre and after ChatGTP?

  • @higherbeingX
    @higherbeingX Год назад +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.

  • @Forshen
    @Forshen Год назад

    at 04:18 We also have Static code from a dependency code base, so we created a Adapter with the name based on the class with the statis methods, example: "ProductAdapter" and the adapter has the same methods as the static class and the adapter methods just calls the static methods. Is this a good way?

    • @nickchapsas
      @nickchapsas  Год назад +2

      Yeah it's the same thing. Normally it's called an adapter but you can also call it proxy, forward method or wrapper.

    • @Forshen
      @Forshen Год назад

      @@nickchapsas ah thanks. Still trying to learn differences between design patterns. But proxy, wrapper, adapter and 'forward method' are all the same thing? I thought there was a difference for the proxy tho, never understood it. But now I know, thanks.

    • @paulkoopmans4620
      @paulkoopmans4620 Год назад +2

      ​@@Forshen Technically "Adapter" and "Proxy" are indeed different things. But they do get mixed up a lot of times.
      But it is all in the names!
      1. Adapter (also called wrapper) => A class that implements an interface, or extends from a base or abstract class and 'wraps'/encapsulates another class. The purpose of the adapter class is to implement the "contract" and forward them to the wrapped class. The wrapped class never had the proper interface but your adapter does the right stuff to make it happen.
      Think the little adapter plugs you use when you travel to a different country; you adapt the one interface to the other;
      2. Proxy => a class that implements an interface and encapsulates a class with that same interface. The purpose of the proxy is to add behaviour either before, after or both and 'proxy'/forward it to the encapsulated class.
      Think a WattMeter; same prong style but the added value is now you are 'logging' traffic.

    • @Forshen
      @Forshen Год назад

      @@paulkoopmans4620 ah well, that makes a lot of sense to be honest. Thanks!

  • @a13w1
    @a13w1 Год назад +1

    Do wonder how well it will be to upgrade old versions of react to modern versions (I guess it depends on how up to date data this references)

  • @LudwigvanBeethoven2
    @LudwigvanBeethoven2 Год назад +2

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

  • @shibalogic5269
    @shibalogic5269 Год назад

    Do you think there agp-4 will be able to make 3d rigged models rendering character creation obsolete? Essentially allowing someone to generate character for their games?

  • @ztBlackGad
    @ztBlackGad Год назад +1

    Hey Nick. Can you try to upload source code to chat as base64 of regular zip and ask it to convert and unzip code. Afterwards refactor? And to receive response ask it to zip and show you base 64 of that thip file?)

  • @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?'

  • @ikarosound2504
    @ikarosound2504 Год назад

    This was exactly the kind of thinks that are looking for!
    I love your channel! Thanks for the video
    I can subscibe also for just 1 month to gpt plus, right?

    • @nickchapsas
      @nickchapsas  Год назад

      Yeah I’m pretty sure you can subscribe monthly but cancel at any time

  • @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.

  • @plamenstoyanov5605
    @plamenstoyanov5605 Год назад

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

  • @ManeshBPandu
    @ManeshBPandu Год назад

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

  • @pilotman9819
    @pilotman9819 Год назад +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.

  • @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.

  • @nguyenvi_cntt
    @nguyenvi_cntt Год назад

    oh how great it is

  • @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.

  •  Год назад

    how do you paste all the code to chatgpt? everytime I try to paste something long I get the "too long" error
    I've tried putting the code on a gist and giving the link, but it doesn't work

  • @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.

  • @ShiroKage009
    @ShiroKage009 Год назад

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

  • @zyzhang1130
    @zyzhang1130 Год назад

    How do you refactor an entire repository though

  • @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 26 дней назад

    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…

  • @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.

  • @StefanoGabriele1983
    @StefanoGabriele1983 6 месяцев назад

    Is there a service where we can give a solution (.net core or framework) and the AI will refactor it for you or help to find bugs or bad practices?

  • @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.

  • @PbPomper
    @PbPomper Год назад

    I'm not so keen on pasting in proprietary code somewhere in the cloud.

  • @magicsmoke0
    @magicsmoke0 Год назад

    I wish GitHub copilot could do this within the ide

  • @attribute-4677
    @attribute-4677 Год назад +1

    I’ve got Plus, but when I hit new chat, I don’t have a model selector. Anyone else have this issue?