Intro
Hello, world! Welcome to another blog post for Anthonyâs Techie Thoughts! If youâre new here, my name is Anthony and Iâm studying programming to make a career change from mathematics teacher to a frontend web developer. In my blog posts, I reflect on my journey and share things Iâm learning along the way. You can find me on GitHub, LinkedIn, Hashnode, DEV.to, and CodeNewbie.
In this blog post, Iâll offer a quick reflection on my progress this week and share some thoughts on how I used ChatGPT as a coding buddy.
Weekly Reflection
This past week has been productive for me. This is mostly because Iâm currently on a mid-term break from work and I have extra time I can dedicate to my studies. Which I am thoroughly enjoying. Hereâs a quick list of my accomplishments this week:
-
Completed the solo project for Module 6 of Scrimbaâs Frontend Career Path
- GitHub Link: https://github.com/ananfito/learning-journal
- Live link: https://ananfito.github.io/learning-journal/
Started Module 7 of Scrimbaâs Frontend Career Path
-
Published a blog post on how I used a Python script to automate a part of my teaching job
- This might seem small, but I had written this post weeks ago and just never published it so Iâm glad I got it out there.
I played around with using ChatGPT as a coding buddy and it helped me figure out a problem I was having with the code for my Learning Journal project (more thoughts on that below)
Using ChatGPT as a âcoding buddyâ
On a whim, I decided to make use of ChatGPT as a âcoding buddyâ by asking it questions when I got stuck or needed a sounding board. As a self-taught dev, this is one of the things Iâve struggled with the most. Sometimes I wish I could just tap someone on the shoulder and say, âHey, what do I need to make this work?â Or âThis is what Iâm thinking for this problem. Is that the right approach?â However, this isnât always an easy option so this week I tried something different: I asked ChatGPT.
For example, I was working on a function earlier this week for my Learning Journal project where I needed it to return the first three elements of an array, but I couldnât figure out what method I needed to use. Initially, I thought I could use the .filter()
method, but further down youâll see how ChatGPT corrected me on that idea. First I asked it, âHow do I write a function in JavaScript to return the first 3 items in an array?â Here is the response I received:
When I asked my âcoding buddyâ this question the first thing it mentions is the .slice()
method and I was like, âOh! duh! Of course, why didnât I think of that?â As requested, it did write an entire function for returning the first 3 elements of an array, but I didnât need the entire function. I just needed that little hint to use .slice()
instead of .filter()
. When I asked it if I could use the .filter()
method it explained why it wasnât possible and why I should use the .slice()
method instead:
(NOTE: While writing this blog post, I noticed that my initial question here has a typo in the first part of the question. Iâm not sure why my brain decided to write âIs it possible to write return âŠâ but ChatGPT seems to have correctly interpreted this to mean âIs it possible to write a function that returns the first âŠâ This is interesting, but could also just be a random occurrence. In the big picture, Iâm not sure if ChatGPT is always good at interpreting human miscommunication.)
This second explanation helped me realize the error in my initial approach and redirect toward a solution that worked. Of course, this is information could have obtained from someone in a Discord community, a forum, or even through reading through webpages and documentation, but those come with a longer time commitment. Here, in a few minutes, I got some advice on the direction I needed to go as well as some examples to reference. In fact, in this case, I just needed a nudge in the right direction. As a self-taught dev, this is particularly useful because I canât just lean over to the next cubicle and ask a coworker quick questions like these. But, for now, I can ask ChatGPT and it (might) give me an answer to ânudgeâ me in the right direction.
Closing thoughts on ChatGPT
As impressive as it ChatGPT is (and other AI software like it), weâve already seen examples of where it will hallucinate and present incorrect information. With that in mind, I do not think it is a good idea to ask it to do a specific task for you.
For example, Iâm sure I could have given it more information and context about how and why I needed a function to return the first three elements of an array, but that would have defeated the purpose of studying. To me, that is the equivalent of having someone else do your work for you. Which doesnât help you become a better developer.
I tell my students, âthe person who holds the pencil learns the math.â Meaning, the person who is sitting there going through the steps (and perhaps struggling a bit) to solve the problem is the one who will learn and remember it. In this case, the person who types on the keyboard learns to code.
All that said, I do think this could become another tool within our developer toolbox. We have a plethora of resources already at our deposal: freeCodeCamp, Stackoverflow, W3 Schools, YouTube, Discord Communities, and more! This is an addition to that and perhaps it might fill in some gaps that the others donât provide or donât meet the needs of the learner. I think this is how Iâll use it moving forward (and continue to use it as long as it proves useful). Itâs one tool in a vast toolbox of tools to help me learn how to code and get better at achieving my goal of making a career switch.
Thanks for reading
Thanks so much for reading this post. Have you used ChatGPT in your studies? If so, how have you been using it? Has it been helpful? Leave your thoughts in the comments below. Hearing your thoughts makes this more of a conversation and helps everyone learn.
Top comments (0)