Software to install:
You will need some sort of *AMP stack, such as WAMP, MAMP, or LAMP. You will also need MySQL Workbench if you’re on Windows, or a terminal window if you’re on macOS or Linux.
Bitnami WAMP: https://bitnami.com/stack/wamp
MySQL Workbench: https://dev.mysql.com/downloads/workbench/
Bitnami MAMP: https://bitnami.com/stack/mamp
Bitnami LAMP: https://bitnami.com/stack/lamp
Please note: although it’s fine to use MAMP or WAMP on your development machine, such as your laptop or desktop, the fact of the matter is that LAMP is what you’ll find on most web servers (although it might be a different LAMP stack rather than the one that Bitnami provides).
Section 11.2 includes step-by-step setup instructions for how to install and set up *AMP and MySQL Workbench. Just wait until you’ve read that far before installing anything.
I also highly recommend using a password manager, because you’ll be making accounts and passwords for things like databases, server OSes, and more. And if you eventually get domain names and web hosting, you’ll need accounts there too. A password manager is a secure way to store login information. Instead of trying to memorize it all, use the same password for everything, or write things down on paper, it’s better to use a password manager such as LastPass:
If you’d rather use something that is offline and open source, check out KeePass:
Front-end, back-end, and full stack
Front-end is code that runs on a client’s device. Back-end is code that runs on a server. Requests, such as Ajax or HTTP, are how you communicate between the two. The combination of software you use for a website is called a stack. A full stack web developer is someone who writes front-end and back-end code, as well as deals with how stuff happens in between them. This book concentrates on a stack called LAMP, which stands for Linux, Apache, MySQL, and PHP. Linux is the OS a server will run (some people might say “actually, Linux is a kernel, not an OS” but you get the idea), Apache is a web server platform used for turning a computer into a web server that users can visit to see web pages, MySQL is database-related software, and PHP is a server-side programming language. You don’t usually run PHP on a computer directly (unless you’re a software developer), but when you go to a website in a browser, that website’s server might be running PHP code behind the scenes to make things happen.
MAMP is LAMP but for Macs. WAMP is LAMP for Windows. Aside from that, they are basically the same.
If you want to see the tech stacks that different companies use, check out this site: https://stackshare.io/
Introduction to back-end and databases
- Databases make data-centric software possible. Social media content or login systems would not be possible without databases. When you leave a comment on Youtube, you’re putting data into a database. When you view Youtube comments, a server is fetching data from a database and sending it to you. When you send a tweet, you’re putting data into a database. When you like someone’s post, you’re adding 1 to an int column (numberOfLikes += 1 for post ID #3424234234234) in a record in a table in a database. When you change your account password, you are updating an existing record in a database. When you submit a login request on Amazon, Amazon’s servers compare your submission to the correct credentials in a database and makes sure they’re the same. If your submitted username and password don’t match what’s in their database, they won’t let you log in. More on passwords in databases later in the chapter though, as that’s a complicated issue.
- Earlier in this book, you learned how to make simple websites, but you did so by putting the content of the site directly into the HTML files, which is called hard-coding (which is simpler for beginners, but considered a bad practice). In most cases, data will actually be stored in a database and web page template files are stored separately. A web server’s back-end code will combine data from a database with a template and deliver it to a user. All the details of how this happens are hidden from the user. Data is separate from the presentation of data. Data could be the text in a comment. Presentation would be the font, color, size, and placement on a page. In hard-coding, they are combined, which is bad.
Classes, functions, print statements, and loops are nice and all, but there’s much more to coding than just that. Without data and databases, programming wouldn’t be very useful at all.
When a company gets “hacked,” what often happened is that a hacker performed SQL injection to get private data from a database that they’re not supposed to be able to see. There are many other types of hacking, but the point is that databases often hold very valuable and private data in them, such as payment information, usernames and passwords, customer contact information, and more. Some data might be public, but not all.