Jonas: These days, everyone seems to be talking about
AI tools for programming,
things like ChatGPT, GitHub Copilot,
the new Cursor AI Code Editor, and so on.
There's a lot of hype in the industry around AI right now,
but there is in fact a place for these tools
in web development and programming in general.
And so I think it's important to learn
and to think about this new reality early on,
and address the questions that you might already have
about what this means for the future.
So that's what this lecture is all about.
Let me just warn you that it's gonna be pretty opinionated,
but I believe that this is what a beginner like you
should know and do.
So as I already mentioned,
we're talking about AI tools like ChatGPT, GitHub Copilot,
or the Cursor AI Code Editor.
And by the time you're watching this,
I'm sure there are already a million
new fancy tools out there.
Now, what all of these have in common
is that they're powered by an LLM,
so a Large Language Model like GPT or Claude,
in order to generate code
based on a prompt the user gives the model,
that's basically all they do.
But different tools have different ways of working
and a different user experience.
So basically, we can ask these tools to write code snippets
or a function for us,
and some tools like Cursor
can even generate entire files based on our prompts.
Copilot and Cursor
also give us a very powerful auto-complete feature
that is aware of the code that you're writing,
your comments, your clipboard,
and also the entire code base.
You can even chat with your code base,
like asking questions
about how certain parts of the app work,
in case you don't understand something.
And all of this works pretty well, sometimes,
and not so well, in some other times,
but more about potential problems later on.
Now, when we choose to work with an AI tool in our code,
or even just for learning
or for writing some simple function,
we need to follow a workflow,
just like we follow a workflow when we're coding
and solving problems ourselves,
without an AI assistant.
And we've already talked about that workflow
for solving problems and the different steps involved
earlier in this section, right?
And so let's now adapt that workflow
for the age of AI,
in case you decide to adopt any of these technologies.
So just like in our earlier workflow,
it all starts with 100% understanding the problem
that we need to solve.
Don't use an AI tool
if you don't even know exactly what you need to solve,
because this will just introduce unwanted code.
You can also apply the divide and conquer step
that we discussed earlier,
to basically divide the problem
into smaller sub-problems,
if it's a really big one,
like you're not gonna tell the AI,
"Just write me a social network like Instagram, right?"
That's way too big, and outright impossible.
You would have to divide that one
into thousands of small sub-problems.
But anyway, next up, you're gonna choose which AI tool
you want to use,
and then you need to write a very specific prompt,
telling it exactly what you want to get done.
For this, it's important to feed the AI
the exact context of the problem,
like what topic it's about,
the exact goal that should be achieved,
what language it should write the solution in,
what coding style you want, and so on.
Then, based on this specific prompt,
the AI will do its magic
and generate a solution to your problem,
and output that solution in the form of code,
and in the language of your choice.
So in our case, that's of course gonna be JavaScript,
but it could also be HTML, CSS,
Python, Java, and so one,
and now here comes the most important part,
where you as the developer
need to very thoroughly
inspect and test the generated code.
Again, this is extremely important
because code generated by AI
can contain lots of bugs,
which are sometimes, very well hidden,
or it can also suggest a solution
that's more complicated or convoluted than necessary.
More about that in the next slide.
But you can already start to see
that these tools should only be used by developers
who already know what they are doing, right?
But anyway, after reviewing and testing the code,
you can use the AI to correct or improve the solution,
by generating a new, very specific prompt
telling the AI assistant what's wrong
and what you need fixed.
So this is a pretty iterative process
until you reach a solution
that you're happy with.
Sometimes, this actually never happens,
in which case, you need to abandon the idea
of using AI for this specific case.
But if you are satisfied with the answer
and are 100% sure that it's correct,
then you can integrate the solution into your code base.
So this is how you would use an AI assistant
to help you write some code,
but when exactly should you actually use a tool like this
and the code that it generates?
Well, before you choose to use an AI assistant
to solve any task,
you first need to make sure
that you actually know
how to code yourself on your own.
So fundamental programming skills
are absolutely essential,
and so that's what this course is for.
Now, I'm giving you this lecture early on
because there are so many questions about AI these days,
and so I wanted to highlight the need
for learning programming right off the gate,
instead of relying on AI
before you even know how to program.
Now, in the same vein,
you also need to be able to solve problems on your own
and develop very good critical thinking.
Critical thinking is especially important
when you're dealing with AI-generated code,
because many times,
it contains bugs that are hard to find,
or the code is simply not good enough.
Always question whether the AI output
actually makes sense.
Finally, coding should sparkle joy and curiosity.
If coding is boring or not exciting anyway,
if you lack the passion for writing code,
then maybe this isn't the right career anyway.
So in summary, I would advise to not just use AI
without knowing what you're doing,
otherwise, AI will turn you into a terrible programmer
or maybe, not even a programmer at all.
If you rely on AI-generated code all the time,
you're gonna grow dependent on it,
and you'll just become someone
who copy=pastes code left and right,
until you have some barely working app,
an app that you don't understand,
can't maintain, and can't fix,
in case anything breaks,
which let me assure you, will break.
So someone like this is not a programmer in my mind.
Now, some people will go ahead and do just this,
so they will just copy-paste,
and they might have some success with it
to a certain degree,
but if you want to do things well,
again, my advice is to learn the fundamentals
from this course
and become a real programmer instead.
Now, this may all sound a bit negative,
but, of course, it is fine to use AI in certain situations,
I do it myself all the time.
But instead of relying on AI to do everything,
you should see AI as an assistant.
AI is meant to help you, not to replace you.
So AI tools can and should be used
to help you save time on repetitive
or mundane tasks like boilerplate code,
so things that don't require you to think much anyway.
AI assistants are also great for learning,
for example, you can just ask it questions
about programming topics,
or you can ask for code solutions,
and then analyze the output step by step
in order to learn something new.
This way, you're gonna find new tools and techniques
that you can learn,
that maybe otherwise you would've missed,
so you wouldn't have known they even existed,
and will actually do all this in the next lecture.
Now, okay, now assuming that you did decide to use AI,
and you now have your AI-generated code,
when is it actually okay
to incorporate this code into your app?
Well, I'm gonna start by reiterating on what I said earlier
because it's just so important.
You should only incorporate AI code
if you could have written that code yourself.
The ideal scenario is that
before asking the AI to write the code for you,
you have already thought of the steps
and the JavaScript features that you might need,
in order to solve the problem,
and maybe even imagined the code in your mind.
Then all the AI does
is to actually write the code you had already imagined,
which is gonna be a lot faster
than you typing it out by hand.
And this actually happens to me many times when I use AI,
and it feels pretty magical, to be honest.
Now, if you could have written the code yourself,
the next guideline is pretty obvious,
but it's still important to highlight the fact
that you should truly understand the generated code
before incorporating it into your code base.
Also, as I already touched on earlier,
you need to ensure that the code is 100% correct.
All this will ensure that errors made by AI,
don't make it into your code base.
This is especially important
for mission-critical parts of your app,
like core business logic,
and so I advise you to not even use AI
for these crucial tasks at all.
So to recap,
it's absolutely okay to incorporate some code
that an AI has written for you,
if you're only using the AI
to be faster at non-crucial tasks,
even though, you could have done it yourself
otherwise, you'll never be able to fix the code
when it eventually breaks,
and maybe even more importantly,
you won't grow as a developer.
But now it's time to finally tackle these big, big questions
that many beginners have,
which go something like,
"Do I even need to grow as a developer now?
Won't AI take my job anyway at some point?
Or, should I even bother learning to code now?"
Well, answering this type of question
is one of the main goals of this lecture.
So the short answer to the question,
"Will AI take my job?"
Is no.
So case closed, right?
Well, maybe not so fast.
Maybe you want to understand why I'm so confident
that developers will still be needed going forward.
Now, I need to preface this by saying,
that this is of course, my personal opinion,
and that I shockingly cannot see the future,
but I've thought about this a lot
and here's what I think.
So the first thing that we should address
is that there is just a lot of hype around AI these days,
and that's true for all industries,
not just web development.
Many people seem to believe
that AI is gonna replace us soon,
and there are actually companies trying to do just that,
but they seem to forget
that we've been in this situation before.
We've had tools like Dreamweaver, or WordPress,
or site builders like Wix in the past,
which were supposed to make web developers obsolete.
But did that ever happen?
No, it didn't,
and I'm sure that it won't happen this time around.
Now, I do believe that AI is here to stay
and that it will be very helpful for us developers,
but it's clearly over-hyped at the moment.
But this brings me to the next point,
which is that, indeed, things will change in the future.
No one knows how much and how fast,
but we can say for sure
that some portions of applications
will be written by AI in the future.
This is already happening right now,
and this tendency is only gonna increase.
But the thing is that this isn't necessarily bad,
as we saw before, AI code can be great
for automating boring boilerplate stuff
that takes up a lot of time,
or other mundane tasks in software development.
This means that for all the other interesting tasks,
you will still be needed.
You the developer,
will always stay in control of implementing
and of adapting the applications architecture,
and of writing the core business logic,
at least, that's how it should work.
You're also the one who asks
the AI for help in the first place,
and you are the one who is gonna review the code, test it,
and finally, integrated it into the app.
So again, the developers are gonna stay in control
and can actively decide
how much they want to involve the AI in their projects,
because the truth is,
software developers do a lot more than just writing code.
They're able to maintain an overview
and see the bigger picture of complex projects,
and they understand and implement design principles.
Now, I guess all this is a bit hard for you to imagine
as you're just starting out
on this programming journey,
but there are just things
that are too complex for AI to handle,
where it's not just writing a few lines of code,
but really thinking hard about problems and solutions,
and so that's where the human programmers come into play.
These humans are also way more creative than AI,
and they're able to actually collaborate
with other developers,
and maybe, even more importantly,
collaborate with the clients.
So it won't be easy to automate all that stuff away with AI,
and it won't happen soon.
On top of this,
as I also already hinted at,
from my experience, AI generated-code
is still pretty buggy,
and often, doesn't give you the best
or most up-to-date solutions.
It's especially bad at debugging non-trivial problems
that span multiple functions or files,
hallucinating solutions that don't solve anything
and just make the code worse and worse
each time you ask it to improve the solution.
I've seen this happening a few times,
where the most state-of-the-art AI models
become completely useless.
So yeah, I think we're pretty safe,
especially when it comes to debugging.
Another aspect that's interesting to consider
is the fact that, right now,
the world actually needs more software
than can be built by us humans right now.
So how many times have you used some terrible website
from a local business,
or used a non-functioning web app
to make a restaurant reservation or something like that?
I know I have,
and if we recruit AI to help us automating the boring parts,
maybe we can improve much of the bad,
or even non-existing software,
which is gonna benefit everyone.
So maybe if AI makes us like 10 times faster
at some distant point in the future,
it might enable us to write 10 times more software.
So those are the kinds of positive effects
that many people don't even think about,
and there are probably many more positive effects
that we can't even imagine yet.
So in conclusion,
AI will help us, not replace us.
It might take some boring coding tasks away,
allowing us to focus on what really matters,
building amazing software,
and building a lot more software faster.
This means, there won't be fewer jobs in the future,
but actually, maybe even more.
So please keep learning JavaScript or React,
or whatever it is you're doing right now,
and don't stop this whole AI narrative
from progressing on your journey
of learning web development
and building amazing software.
Plus, learning programming teaches you foundational skills
like logic and reasoning.
Basically, it teaches you how to think,
and those skills will always be relevant,
and maybe even more so in the future.
And with this being said,
let's now actually try our hands at using AI
to solve a challenge,
following the process and the guidelines
that we just talked about in this video.