Ruby on Rails

Summarized using AI

Getting the most out of Chat GPT

Jason Swett • December 14, 2023 • Bucharest, Romania

In the video titled "Getting the most out of Chat GPT," Jason Swett discusses the applications and effectiveness of ChatGPT, particularly in programming tasks. Throughout the talk, he emphasizes the importance of understanding the surrounding tasks in the software development lifecycle that extend beyond just coding.

Key points discussed include:
- Initial Experiences: Participants share their first interactions with ChatGPT, mentioning use cases like writing emails, converting database syntax, and generating scripts.
- Programming Applications: Swett explores various programming-related tasks where ChatGPT can be beneficial, such as writing tests, refactoring methods, and planning projects. He notes that while some initial expectations around generating entire programs may not hold true, there are many valuable applications for ChatGPT beyond code generation.
- Limitations and Evolution: He acknowledges criticisms about ChatGPT, especially regarding its tendency to produce inaccurate results ('hallucinations') in coding. However, he suggests that the advent of ChatGPT-4 has significantly improved its performance.
- Different Levels of Abstraction: Swett introduces the concept of abstraction in programming and how ChatGPT can help by alleviating the low-level tediousness programmers often face.
- Use Cases Beyond Coding: He suggests several effective uses for ChatGPT in software development, such as:

- Learning about specific domains related to the software being developed.

- Assisting in creating abstractions within code.

- Enhancing creative writing and generating localization files.

- Automating testing processes and clarifying documentation regarding new technologies.
- Cautious Utilization: The speaker stresses the importance of not fully relying on ChatGPT without validating the outputs, thus advocating for maintaining programming skills and critical thinking.
- Future Implications: He envisions a future where interaction with tools like ChatGPT becomes even more seamless, improving efficiency in the programming process.

In conclusion, while ChatGPT may not be the best at generating complete programs, its greatest value lies in aiding with testing, learning new technologies, and project planning. These capabilities enable programmers to focus more on high-level objectives rather than getting bogged down in low-level details. Swett also shares information about his podcast, newsletter, and a forthcoming book titled 'The AI Advantage,' encouraging further engagement from the audience.

Getting the most out of Chat GPT
Jason Swett • December 14, 2023 • Bucharest, Romania

Jason Swett is the host of the Code with Jason podcast, Code with Jason Meetup, and author of his snail mail Nonsense Monthly and The Complete Guide to Rails Testing book.

Friendly.rb is an International Ruby Conference hosted in Bucharest at the end of September and focuses on community and creating connections.

https://friendlyrb.com
https://twitter.com/friendlyrb

Friendly.rb 2023

00:00:07.759 When ChatGPT-3 first came out, I took it for a test drive. Did anybody else do that? What did you do with it? What prompt did you type in? Did you try anything interesting, like asking it to send you a joke?
00:00:28.039 I’m really bad at writing, so I used it to write emails. What about you? Raise your hand if you have any use cases. Who here wrote a short Shakespeare play?
00:00:40.719 Okay, who used it for programming-related tasks? Just to convert from one database technology to another—like, here’s a script that builds some inserts for one database technology. Can you show me how it would look with PostgreSQL? This conversion between different small syntax differences worked out very well. In summary, it was about converting syntax from one database management system to another.
00:01:28.759 Okay, who else? Yes, go ahead, what did you use it for?
00:01:43.799 Yes, I used it to write a Rails controller, but that didn’t work out well for me. I also tried writing some bash scripts, which worked well.
00:02:13.519 Then there were method naming conventions—how did that work for you? Better? Great! How about you, Adrian?
00:02:31.239 The prompt was to convert some video files using FFmpeg. Anyone else have any interesting use cases?
00:02:45.200 How about planning road trips? Not programming related, but interesting nonetheless. Any constructive criticism or feedback on performance?
00:03:01.680 Someone used it to refactor a method. How did that work out? It depends, right? That’s often my experience too. When I first tried ChatGPT-3, I thought the most obvious use case was to write some code for me, like writing a program that does a specific task.
00:03:33.400 Did anybody else use ChatGPT to write a program or function? Raise your hand if you asked it to write one and ended up liking the result. Did it require just a few small adjustments to work? Now raise your hand if you felt what it produced wasn’t usable at all.
00:04:18.239 I see a lot of criticism online about ChatGPT, where people say it hallucinates a lot and doesn’t write very good code. For example, it may make a library call for a function that doesn’t exist. Because of this, some people dismiss ChatGPT entirely.
00:04:56.199 That was my initial feeling. However, two important things happened that changed my mind. Before we go on, let me count how many of you still think ChatGPT isn't very helpful for programming.
00:05:31.080 Thank you! I think a lot of us are somewhere in the middle, and I hope everyone will at least find one useful tidbit from this talk.
00:05:49.680 The first realization I had was that writing code is not the best use case for ChatGPT. There are many other parts of the software development lifecycle before you start coding. First, you must define what you’re going to do and design the feature or change you want to implement. Next, there’s testing, deployment, monitoring, and more—all activities surrounding that final coding step.
00:06:23.840 Considering all of this, writing code is actually a small part of the process, and it's not necessarily the hardest part either. So if we claim that ChatGPT isn’t great for writing code, we have to consider that it can still help us with the larger tasks surrounding coding.
00:06:50.079 Moreover, how often does a human write a big chunk of code and assume it’s perfectly good? Typically, we write code incrementally, test it, ensure it works, and then commit it. Hiring a contractor to write an entire program without any checks is not something we would usually do.
00:07:15.480 So that expectation that we can use ChatGPT just to pull together a large piece of code doesn’t align well with how we typically code. This is one realization I had.
00:07:42.560 The second thing is that ChatGPT-4 came out. This change is significant because ChatGPT-4 is so much smarter than ChatGPT-3 that it feels like a completely different product.
00:08:12.080 Let me ask—raise your hand if you’re using ChatGPT for programming. Now keep your hand up if you’re using version 4, and if you’re not sure, it probably means you’re using version 3.
00:08:30.600 If you haven’t upgraded to ChatGPT-4 yet, I implore you to. It's worth way more than the subscription fee, and the productivity you gain from it absolutely pays for itself.
00:09:00.640 Are you familiar with the three levels of abstraction in programming? Pottery, accounting, and inventory—lessons in abstraction can help us programmers.
00:09:21.200 Think back to a time when you owned a pottery store and had to manually add up how much money you made last month; you were working at a very low level of abstraction, doing tedious mental grunt work.
00:09:40.960 Fast forward—now you’ve got calculators, which elevate your work one level up and save some effort.
00:09:53.840 Then, with the advent of accounting and inventory software, you really level up in terms of the mental grunt work. You don’t have to think about low-level details anymore, so this is a relevant progression for us programmers.
00:10:11.240 As humans, we conceptualize our end goals, like building ticketing software, but we often face low-level tedium—before frameworks like Rails, programming in raw PHP involved a lot of manual work. With Rails and other tools, we can focus less on the mechanics and more on our bigger goals, and likewise, ChatGPT can help us mind those details.
00:10:40.440 So, if writing complete programs isn’t the best use case for ChatGPT, what is? One suggestion is learning about your domain. If you’re writing software for a pottery store, you might use ChatGPT to learn more about pottery.
00:11:06.000 Another use case could be creating abstractions in your code. ChatGPT can assist in identifying appropriate abstractions based on the knowledge you have about your domain, making the process smoother.
00:11:26.000 Creative writing is another suggestion, particularly if you need inspiration or want to structure your writing. You could even use it for localization, creating entire localization files and handling translations across multiple languages.
00:11:54.200 Also, writing tests is an area where ChatGPT shines. You might say, 'I want to test this specific functionality,' and ChatGPT could generate helpful boilerplate for you to modify as needed.
00:12:16.520 However, be cautious—ChatGPT can generate tests that aren't appropriate unless you have some testing skills to validate what it outputs. It’s like having a friend help you brainstorm tests, but you need to keep your programmer’s hat on.
00:12:43.760 The last thing to point out is that ChatGPT can aid in automating your testing processes significantly. For example, when I was working on tests for a project, I described the test case to ChatGPT, which generated the corresponding code.
00:13:02.960 I'd run the test, see it fail, provide the failure message back, and watch as it generated the code to resolve the issue. This iterative process made it feel like collaborating with a fellow programmer.
00:13:28.680 As this technology evolves, I envision a future where these interactions could become more seamless. The goal is to automate parts of this process where you'd not have to switch between ChatGPT and your code editor manually.
00:13:49.920 Regarding new technologies—one of the more tedious parts of programming involves learning, especially when documentation is lacking, and this level of frustration can turn beginners away.
00:14:07.920 For instance, Docker documentation often causes confusion. You might run into a particular term that’s troublesome—here's where ChatGPT can help clarify by allowing you to ask questions in context, understanding what parts of the documentation don’t make sense.
00:14:25.520 You can request for tailored tutorials or get stuck on something and need clarification. This makes it significantly easier to learn new technologies.
00:14:45.560 In programming, we engage in planning at various levels. Whether it’s the next six months or what we’ll do in the next five minutes, ChatGPT can assist in those discussions.
00:15:06.440 For instance, when I wanted to build a chess-playing robot, I asked ChatGPT to help me plan the project, but I instructed it to first ask me questions about what my needs and goals were.
00:15:29.840 This shift of mental burden is incredibly useful, allowing for a more efficient planning process. The tool asked insightful questions I hadn't previously considered, and this helped me focus my direction without getting lost.
00:15:55.040 Remember, at no point should ChatGPT replace skill. If you don’t scrutinize the information it gives you, you might end up in a worse situation. ChatGPT enhances what good programmers can do and may exacerbate issues for inexperienced ones.
00:16:28.760 Takeaways include that while generating entire functions or programs can be useful, often the greatest value lies in testing, learning new technologies, and planning. ChatGPT allows us to focus more on high-level objectives rather than low-level tasks.
00:16:54.840 I host a podcast called The Code with Jason. Guests include industry leaders like DHH and Sandy Metz. I hold two weekly Meetups, one of which is designed for European time zones, happening on Sundays at 18:00 Bucharest time. I encourage everyone to join.
00:17:20.200 Additionally, I publish a snail mail newsletter that subscribers seem to enjoy. I have an upcoming book titled 'The AI Advantage', due for release through Manning in 2024. This book expands on concepts discussed today.
00:17:47.200 Finally, you can find all this information on codewithjason.com. My email is [email protected], and I’m on Twitter as @jason_swett. I’m more than happy to continue any discussions in the hallway.
Explore all talks recorded at Friendly.rb 2023
+10