Preface
Who Should Read This Book
Programming Has Changed
It takes 10,000 Hours to become an expert
Resist the temptation to skip ahead
The concorde fallacy
You're not learning PHP
Getting braces and semicolons in the right place is the easy part
You won't get anything done by planning
Resist the temptation to skip ahead.
This is one I reiterate time and time again for my students who miss lectures.
Progamming concepts build on top of each other. For the most part, you need to learn
the earlier concepts before you can move on to the next one. If you try to move too fast,
you'll get needlessly confused and make it more difficult for yourself.
There aren't many programming concepts that exist in isolation, so if you get stuck, it's
often a result of not fully understanding an earlier concept. Don't be afraid to go back and
give yourself a refresher on what you think you already know from before. It's usually quicker
overall than struggling and trying to press forward when you get stuck!
You're not learning PHP.
Yes, you read that right. This book is focused entirely on PHP and MySQL, but don't fall into the
trap of thinking you're learning PHP. Well, you are learning PHP, but I'm using PHP to teach you to
code.
When you learn to drive, you don't learn to drive a Ford. You learn the concepts of driving, and you
can apply them to any car you get in, even if a few of the controls are in a different place.
Concepts you'll learn here will apply to almost any other language you wish to learn in the future.
Sure, there are some differences, but the underlying concepts are the same.
Once you can program proficiently in one language, you can get to a reasonable standard in another within
a few days! So don't read this book thinking "I'm learning PHP," but instead think "I'm learning to code."
It's more important to remember the concepts than the syntax. You can always look up the correct syntax, but
understanding the underlying concepts is more difficult. Which brings me to my next point...
When you start out, you'll constantly put brackets, braces, semicolons, dots and pretty much everything else
in the wrong place. You'll forget to put in a single character and your whold program won't work.
This can be incredibly frustrating at first! But once you get the hang of it, you soon realize that getting
the syntax right is the easy part. It's easy because it's strict. It's either right or it's wrong. It works or
it doesn't.
The hard part is actually writting the logic, breaking a problem down its smallest parts so you can explain
it to the computer. The computer will quickly tell you if the syntax is wrong, but there's no way for it to
tell you whether you've given it the right instructions to solve the problem at hand.
You won't get anything done by planning. - Karl Pikington
If you've done any reading about programming, you've probably heard that you need to spend lots of time
designing your code - that you should carefully plan tht logic of your program and how it will work before
writing a single line of code. You'll come across books and articles that teach development methodologies,
something called "requirements engineering", diagrams for visually representing code, and all sorts of tips
on how to plan your code out before you write it.
The best way to learn to code is to start writing.
The fundamental problem with this advice is that it forgets a somewhat obvious fact: to design software, you
need to know what tools are available and the problems they solve. Otherwise, any desing you come up with wiill
be meaninglessly if you don't know what tools are available.
Let's assume you know nothing about building a house. You don't know how to use a hammer, a saw, how strong
a beam needs to be to support your roof, how deep your foundations need to be, how to plumb in the bathroom,
what materials are suitable for which part of the house, etc.
You can spend as long on the desing as you like and plan things as carefully as possible, but unless you know
what your tools are capable of and their limitations, you'll end up with a design that doesn't fully utilize the tools,
or a design that just isn't possible with the tools/materials available to you. Without knowing that you need
a six-meter foundation for a three-story house, you can't design a three-story house.
TED talk called "Want to help someone? Shut up and listen", by Ernesto Strolli.
However, all that planning and designing was wasted because of something they didn't see coming.
Try solving some of the problems I set before I give you the solutions.
As your knowledge grows, you'll have firmer understanding of what tools are availab and the way problems need\
to broken up. Once you reach that level, you can start planning things out in more detail before writing your code.
Whatever you do, don't look down!
Okay, maybe you should look down.
Common web server software programs you may have heard of include Apache HTTP Server(Apache), NGINX and
Internet Information Services(IIS).
PHP is a server-side scripting language. You can think of it as a plugin for your web server that enables
it to do more than just send exact copies of the files requested by web browsers. With PHP installed, your
web server will be able to run little programs(called PHP scripts) that can do tasks like retrieve
up-to-the-minute