49,19 €
This book offers a comprehensive guide to full stack web development, covering everything from core web technologies to advanced topics. The early chapters introduce foundational concepts like client-server relationships, HTML, CSS, and JavaScript. Readers learn how to build static and dynamic web pages, gaining a solid grounding in front-end development.
As the book progresses, it delves into more advanced areas such as structuring applications, databases, and server-side programming using frameworks like Node.js and PHP. Practical examples, such as building web servers and handling data, help readers apply their skills in real-world scenarios, bridging the gap between theory and practice.
The later chapters address crucial topics like web security, performance optimization, and project management. Readers are introduced to modern practices like Docker, microservices, and Agile project management, equipping them to handle scalable, secure applications. By the end, readers will have a holistic understanding of how to build, secure, and deploy full stack applications, making this book ideal for both beginners and experienced developers seeking to refine their skills.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 918
Veröffentlichungsjahr: 2024
Philip Ackermann
The Comprehensive Guide
This e-book is a publication many contributed to, specifically:
Editor Meagan WhiteAcquisitions Editor Hareem ShafiGerman Edition Editor Stephan Mattescheck, Patricia SchiewaldCopyeditor Yvette ChinTranslation Winema Language ServicesCover Design Graham GearyPhoto Credit Shutterstock: 1159836532/© optimarc; 1682920144/© klyaksunProduction E-Book Kelly O’CallaghanTypesetting E-Book Satz-Pro (Germany)
We hope that you liked this e-book. Please share your feedback with us and read the Service Pages to find out how to contact us.
The Library of Congress Cataloging-in-Publication Control Number for the printed edition is as follows: 2023024562
ISBN 978-1-4932-2437-1 (print)ISBN 978-1-4932-2438-8 (e-book)ISBN 978-1-4932-2439-5 (print and e-book)
© 2023 by Rheinwerk Publishing Inc., Boston (MA)1st edition 2023
“A jack of all trades is a master of none, but oftentimes better than a master of one.”
This little saying has gone through quite the transformation over the years. Coined in either 1592 or 1612, depending on who you want to credit, it originally just read a jack of all trades and had a fairly flattering connotation. Later, in the late 1700s, the master of none part was added, flipping it into a mild insult. The second line—but oftentimes better than a master of one—is more modern, but brings us back to it being a compliment (at least mostly)
These days, full stack developers are expected to be jacks of all trades, though it seems that most employers are hoping they’ll be masters of all, instead of masters of none. While we can’t promise that this book will make you master of both frontend and backend development (such a book would need to be 5,000+ pages!), it’s the place to begin for a thorough grounding in all aspects of web development. Whether you’re a frontend developer looking to expand your backend knowledge, a backend programmer looking to try your hand at UI design, or brand new to both, this book is for you!
What did you think about Full Stack Web Development: The Comprehensive Guide? Your comments and suggestions are the most useful tools to help us make our books the best they can be. Please feel free to contact me and share any praise or criticism you may have.
Thank you for purchasing a book from SAP PRESS!
Meagan WhiteEditor, SAP PRESS
[email protected] Publishing • Boston, MA
This e-book is protected by copyright. By purchasing this e-book, you have agreed to accept and adhere to the copyrights. You are entitled to use this e-book for personal purposes. You may print and copy it, too, but also only for personal use. Sharing an electronic or printed copy with others, however, is not permitted, neither as a whole nor in parts. Of course, making them available on the internet or in a company network is illegal as well.
For detailed and legally binding usage conditions, please refer to the section Legal Notes.
This e-book copy contains a digital watermark, a signature that indicates which person may use this copy:
You are reading this e-book in a file format (EPUB or Mobi) that makes the book content adaptable to the display options of your reading device and to your personal needs. That’s a great thing; but unfortunately not every device displays the content in the same way and the rendering of features such as pictures and tables or hyphenation can lead to difficulties. This e-book was optimized for the presentation on as many common reading devices as possible.
If you want to zoom in on a figure (especially in iBooks on the iPad), tap the respective figure once. By tapping once again, you return to the previous screen. You can find more recommendations on the customization of the screen layout on the Service Pages.
In modern web development, you can hardly afford the luxury of claiming to be a purely frontend or backend developer. To make an application a success, you need to think outside the box, which can easily become frustrating, especially in the web world with its short release cycles and short-lived libraries. These demands make it all the more important to create a solid introduction to the topic and to continuously develop from this point.
The term full stack developer has become established, and not without reason. To me, this designation means less the idea that every developer in a web project must be able to do everything, but that everyone should have an overview of the overall system of a web application and understand the interrelationships. This overview starts with the infrastructure on which the application gets executed, continues with the organization of data storage and the backend of the application, and ends with the implementation of the frontend. A full stack developer is not necessarily only equipped with broad but shallow knowledge but may also specialize on one topic. At this point, the view of the overall system must not be lost.
This book is your ideal companion for getting started in full stack development. You’ll get an overview of all topics important for the implementation of a full-fledged web application: starting with the frontend with Hypertext Markup Language (HTML), Cascading Style Sheets (CSS), and JavaScript over backend interfaces to the storage of information in databases. But topics like testing, deployment, and the organization of the source code with version control aren’t neglected either. In the process, Philip Ackermann not only teaches you how to use modern technologies but also explains concepts that are necessary for understanding applications and that help you become familiar with common libraries and frameworks. JavaScript as a technology forms an important basis in this context since it can be used both on the client and server side. Since the monopoly of JavaScript in the frontend means that you can’t avoid the need for solid basic knowledge of this language, you can make your life as a full stack developer much easier if you also use JavaScript on the server side in the form of the Node.js platform. The following principle applies: Take a look at other solution approaches such as C# or Python, get inspired, and find the approach that suits you best.
I want to take this opportunity to thank Philip for allowing me to contribute to this book with Chapter 10 on React. You can use React as an opportunity to consider single-page application development and learn about the architectural and design principles of this type of web frontend. Although the major frontend frameworks differ from each other in their implementation details, sometimes significantly, the basic paradigms are the same everywhere.
Of course, no book can make a full stack developer out of you. However, your expectation should be taking your first steps on a long road ahead. At the end of each chapter, Philip provides a list of further reading to delve more deeply into each topic.
I now hope you enjoy working through this book and that you gain many new insights from it.
Sebastian SpringerAßling, Germany
When developing web applications today, it’s true that there are more options and better tools than 20 years ago. However, the demands on developers have also increased. Practically every job ad for web developers uses the word “full stack” and requests numerous skills in a wide variety of areas. In short, “full stack developers” are in demand as never before.
However, the demands on such full stack developers are enormous. No wonder, since “full stack” refers to an entire technology stack that must be mastered to develop a web application “from front to back”—that is, from the frontend to the backend—and then prepare it for productive use.
I remember well when I myself first encountered web development, around the turn of the millennium—about 20 years ago—before I started studying computer science. During my training as a media designer, I devoured entire books on Hypertext Markup Language (HTML), Cascading Style Sheets (CSS), and JavaScript; worked through online tutorials; and developed like crazy. These three languages for the web, which are still important today, were enough for me as a web developer at that time.
During my studies, and while working as a student assistant at the Fraunhofer Institute for Applied Information Technology, I came into contact with a “real” programming language for the first time—Java—and gradually got to know the other layers of a web application: the layers on the server side. My task was to convert a Java-based desktop software to a web application based on web services.
Later, and thanks to Node.js, we implemented the application almost completely from scratch using JavaScript, which had meanwhile turned into a serious programming language for the server side. We also swapped the formerly relational database for a non-relational database due to new requirements.
For almost six years now, I have been employed at Cedalo GmbH, now as a chief technology officer (CTO), where we develop several software products. Here, too, I am still concerned with all levels (i.e., with the entire “stack” of the software) regardless of whether we’re selecting the right database for a particular use case or defining the right interface for a web service. These issues come across my desk on a daily basis. To ensure that the finished software products are properly prepared for production systems, DevOps topics have now also been added to my toolbox.
Why am I telling you all this? Certainly not for me to present my resume to you. But because exactly the topics mentioned—HTML, CSS, JavaScript, web services, databases, DevOps—are now requirements for all full stack developers. Of course, deciding where to start and what exactly to focus on can be difficult.
This book is intended to serve as both a roadmap and a guidebook for you. I would like to use my knowledge from more than 20 years in web and software development to teach you the most important basics for full stack development in a compact way. On one hand, I want to help you conquer your fear of sheer number of topics, and on the other hand, I want to teach you which topics are really important.
No matter if related to frontend development or backend development; related to the implementation of web services or the selection of the right database; or related to topics like security, automated testing, or the deployment of web applications, in this book, you’ll find everything you need as a full stack developer.
The book is aimed primarily for newcomers to web development who want to gain a comprehensive overview of full stack development. Thus, you don’t need previous knowledge of HTML, CSS, and or programming. This book is designed to guide you on the path to becoming a full stack developer and effectively teach you the important technologies.
In total, this book consists of 23 chapters on topics that I felt were particularly important when it comes to web development and full stack development. For a slightly more detailed description of each chapter, see Chapter 1. So, if you’re still deciding whether or not to buy, and I haven’t been able to convince you up to this point, now would be a good time to take a quick look at Chapter 1. ☺
Additionally, you can find the source text for this book at its official website at www.rheinwerk-computing.com/5704. Alternatively, the source code is also available in a GitHub repository at https://github.com/cleancoderocker/webhandbuch.
I advise working through the book from cover to cover, chapter by chapter. This order is the best way for you to understand the context of each topic and ensures that you don’t miss anything important.
Of course, the book is also intended to serve as a guide and reference book that you’ll be happy to pull off the shelf again and again to refresh your knowledge as needed. Both the chapter headings and the index should enable you to quickly find the topic you’re looking for.
Writing a book always involves all kinds of work. At this point, I would like to thank all those who made this book project possible and helped me with it.
Most of all, I would like to thank my wife and children for their patience and support while I worked on this book.
In addition, I would like to thank my editor Stephan Mattescheck for the—as always—very professional and friendly collaboration, as well as the entire team involved at Rheinwerk Computing. My thanks go to Sascha Kersken and Sebastian Springer for their always extremely useful expert opinion and the many helpful hints and suggestions.
I would also like to thank you, the reader, first for buying this book of course, but also for the time you’ll spend reading and working through it. I hope you’ll enjoy it and learn many new things.
Of course, I am very happy to receive feedback on this book. I’ll be happy to answer any questions or suggestions you may have at [email protected]. You can also visit www.rheinwerk-computing.com/5704 or www.fullstack.guide for more information and updates on this book.
Philip AckermannRheinbach, Germany
This first chapter provides an overview of web development and explains the most important terminology.
Everybody talks about full stack development, but to understand what it actually is, we first need to look at its basic principles. The first and second parts of this chapter deal precisely with these basic principles, before we turn to the concept of full stack development in the third part.
In this part, I first want to provide an overview of important terms relevant to web development. Then, we’ll take a look at the basic structure of web applications.
Web pages and web applications (see the box for definitions and differences) generally have parts: one that is executed on the client side (the frontend) and one executed on the server side (the backend). On the server side, a web server ensures that the website is available. On the client side, the web application is accessed via a web client (also referred to as the client or user agent). Usually, the client is a web browser (browser for short), but other types of clients also exist, such as screen readers, command line-based or program-controlled Hypertext Markup Language (HTML) clients, or headless browsers, which don’t have a graphical user interface (GUI).
When you call a web page in the browser, the following procedure is executed: On the client side, the user enters an address into the address bar of the browser, a Uniform Resource Locator (URL), discussed further in Section 1.1.2, and confirms the loading of the web page by clicking the corresponding browser button. The browser then generates a request in the background that is sent to the server via the HTTP protocol (Chapter 5). This request is also referred to as the HTTPrequest. On the server side, the web server receives the request and generates an appropriate response (HTTPresponse) to send back to the client. The browser, in turn, receives the response and renders (that is, visualizes) the web page. The browser automatically loads any required resources, such as images, so that they can be displayed.
Figure 1.1The Client-Server Principle
Throughout this book, I use the terms web page, website, and web application, which are often incorrectly used interchangeably. For this reason, let’s briefly clarify these terms: A web page refers to a single HTML document that can be accessed at a specific URL, whereas a website is a collection of several such individual web pages, for example, the websites for this book: http://www.fullstack.guide/and the publisher’s website www.rheinwerk-computing.com/5704. A web application, on the other hand, is a website that feels more like a desktop application. Examples include Google Documents and Google Sheets. A synonym for these interactive and sometimes complex web applications is Rich Internet Application.
As mentioned earlier, the address you enter into the address bar of the browser is referred to as a URL. Examples of URLs include the following:
https://www.philipackermann.de/
https://www.philipackermann.de/static/img/profile.jpg
https://www.webdevhandbuch.de/static/styles/styles.css
https://www.webdevhandbuch.de/service/api/users?search=max
A URL consists of several different parts.
Figure 1.2 Structure of URLs
Let’s breakdown the parts of a URL, as follows:
Protocol/schemaDefines the protocol to be used. Possible protocols include:
HTTP: The HTTP protocol, or its secure variant Hypertext Transfer Protocol Secure (HTTPS), is used to transfer web pages.
File Transfer Protocol (FTP): This protocol is used to transfer files to or from an FTP server.
Simple Mail Transfer Protocol (SMTP): This protocol is used for the transmission of emails.
Host name Sometimes also host, uniquely identifies the web server. The host consists of a subdomain, a domain, and a top-level domain. For example, the host “www.cleancoderocker.com” consists of the subdomain “www,” the domain “cleancoderocker,” and the top-level domain “com.”
PortSpecifies which “channel” to use to access the web server. Usually, you won’t see this part when “browsing normally” because standard ports are used (for example, 80 for HTTP or 443 for HTTPS, see also https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers) and thus are not shown in your browser’s address bar. However, for local development and especially for developing web services (Chapter 13), you’ll deal with custom ports more often. For example, a URL of a web service running locally on your computer might look like “http://localhost:8080/myservice/api/users.”
PathSpecifies the path on the web server to access the requested file (or more generally to the requested resource because the item being served isn’t always a file in the physical sense). For example, in the URL “https://www.philipackermann.de/static/img/profile.jpg,” the “/static/img/profile.jpg” is the path. The path separator is always a forward slash.
Query stringThis text can be used to pass additional information in the form of key-value pairs, which the web server can then use to generate the HTTP response. A query string is introduced by a question mark. The individual query string parameters are connected by an ampersand, and the keys and their values are separated by an equal sign, for example, “https://www.philipackermann.de/example?search=javascript&display=list.”
FragmentThis text allows you to “target” a specific location within a web page so that the browser “jumps” directly to that location when the web page loads. This part is introduced by the # character, for example, “https://www.philipackermann.de/example#chapter5.”
Every web server has a unique address through which it can be reached—the web server’s IP address, either in IPv4 or IPv6 format. Technically, these values are 32-digit binary numbers (for IPv4) and 128-digit binary numbers (for IPv6), for example, 192.0.2.45 or 0:0:0:0:ffff:c000:22d, respectively. But since no one can memorize these cryptic-looking addresses, Domain Name System (DNS) servers contain mappings of host names to IP addresses and return the IP address of the corresponding web server for a host name.
Thus, when you enter a URL (and, thus, a host name), the browser—before it can make a request to the actual web server—first asks a DNS server to retrieve the IP address of the web server based on the host name you’ve entered. Only when this information is received does your browser make an actual request to the web server, as shown in Figure 1.3.
Figure 1.3 The DNS Principle
In web application development, three languages are crucial and indispensable for web developers, especially for frontend development: the HTMLmarkup language, the Cascading Style Sheets (CSS)style language, and the JavaScriptprogramming language. In this section, I’ll explain the relationship between these three languages. Then, we’ll explore each of these languages in the chapters that follow.
HTML enables you to define the structure of a web page and specify the meanings (the semantics) of the individual components on a web page by using HTML elements and HTML attributes. For example, you can describe an area on the web page as the main content and another area as navigation, and you can define components, such as forms, lists, buttons, input fields, and tables, as shown in Figure 1.4.
Figure 1.4 Using HTML to Define the Structure of a Web Page
We’ll describe HTML in detail in Chapter 2.
HTML alone does not make a website visually appealing. CSS is responsible for this part. Using CSS rules, you can design how the individual components you’ve previously defined in HTML should be displayed. Thus, you can use CSS to define the design and layout of a web page. For example, you can define text colors, text sizes, borders, background colors, color gradients, and so on.
As shown in Figure 1.5, we used CSS to adjust the font and font size of the table headings and table cells, to add borders between table columns and table rows, and to alternate the background color of the table rows. This design already looks a lot more modern and appealing than the standard visualization of pure HTML shown earlier in Figure 1.4.
Figure 1.5 Defining the Layout and Appearance of Individual Elements of Web Pages with CSS
In Chapter 3, you’ll learn exactly how CSS works.
HTML defines the structure, while CSS defines the design and layout. Contrary to common belief, neither is a programming language sincethey don’t allow you to implement application logic within a web page, which is exactly where JavaScript comes into play. Unlike the other two languages, JavaScript is a programming language for adding dynamic behavior to a web page (or to components on a web page) to increase interactivity.
Examples of possible dynamic behaviors include sorting and filtering table data, as shown in Figure 1.6 and Figure 1.7, generating dynamic content on the client side, client-side validation of form input (although partially possible with HTML), and much more.
Figure 1.6 Making User-Friendly and Interactive Web Pages with JavaScript: Sortable Tables
Figure 1.7 Making User-Friendly and Interactive Web Pages with JavaScript: Filtering Data
A more detailed introduction to JavaScript will follow in Chapter 4.
In most cases, a web page consists of a combination of HTML, CSS, and JavaScript code, as shown in Figure 1.8.
Figure 1.8Combining HTML, CSS, and JavaScript within a Web Page
HTML structures a web page, CSS is for layout and design, and JavaScript add behaviors and interactivity. HTML and CSS aren’t programming languages—HTML is a markup language, and CSS is a style language. Of these three languages, only JavaScript is a programming language.
As mentioned earlier, web pages have a part that runs on the client side and one part that runs on the server. Basically, however, a distinction must be made in this regard: With static web pages, the web server only provides static content in the form of files from its file system (i.e., HTML, CSS, JavaScript, images, etc.), as shown in Figure 1.9.
Figure 1.9 The Principle of Static Web Pages
With dynamic web pages, on the other hand, the web server generates the content (in the form of HTML code) dynamically at runtime and sends this content back to the client. The data that determines what content is generated is usually retrieved by the web server from a database, as shown in Figure 1.10.
Figure 1.10 The Principle of Dynamic Web Pages
Static web pages are usually not as complex to implement as dynamic web pages because their backends consist of simple web servers that simply send files to clients (without any backend logic to implement). Dynamic web pages, on the other hand, can become pretty complex depending on the use case.
Now that you have an idea of the most important terms in web development, I want to show you what the term “full stack” is all about, where it comes from, and the tasks expected of a full stack developer.
A software stack (also a solution stack or just stack) is a concrete selection of certain components that together form a platform with which an application is developed and operated. Individual components of a stack can include the following:
The operating system on which the software or application runs (both the client-side and server-side operating systems). The classic operating systems are Linux, macOS, and Windows, but mobile operating systems, such as Android or iOS, are now commonplace.
The web server that hosts the application, for example, nginx or Apache HTTP Server.
The programming language that implements the application logic, for example, JavaScript, Java, C++, or PHP (see also Chapter 13).
The programming tools (tools) used during development, such as compilers to translate human-readable source code into computer-readable machine code.
The libraries that are used, such as frontend libraries like Lodash (https://lodash.com/) or jQuery (https://jquery.com/).
The frameworks used, such as web frameworks like Express (https://expressjs.com/).
The runtime environment under which the application is executed, for example, the JavaScript runtime Node.js, which allows JavaScript code to be executed on the server side as well (see Chapter 14).
The databases used, such as relational databases like MySQL and PostgreSQL or non-relational databases (also NoSQL databases), such as MongoDB (see Chapter 14).
The term stack reflects how the individual components are arranged hierarchically in the platform and appear “stacked on top of each other,” as shown in Figure 1.11.
Figure 1.11 Software Stacks as a Selection of Specific Components for the Development of Applications
In web applications, a distinction is also often made between a server-side stack (server stack) and a client-side stack (client stack), which can be fundamentally different. For example, a common practice is to use a programming language like Java to implement the backend and then use HTML, JavaScript, and CSS to implement the frontend. Conversely, you can conceivably program a backend in JavaScript and a frontend in Java (for example, when developing an app for Android-based smartphones).
One of the best known (and oldest) examples of a backend stack is the LAMP stack—a combination of Linux (operating system), Apache (web server), MySQL (database), and PHP (programming language). Variants of the LAMP stack might use another operating system instead of Linux, for instance, WAMP (variant for Windows) and MAMP (variant for macOS). Newer variants of this stack also use Ruby or Python as the programming language instead of PHP.
Not quite as old, but perhaps more well known, is the MEAN stack, which does not distinguish quite properly between backend and frontend. A MEAN stack consists of MongoDB (a non-relational document database), Express (a web framework and a web server), Angular (a frontend framework), and Node.js (a server-side JavaScript runtime environment). This combination offers a charming advantage for developers in that the same programming language is used for both the client side and the server side.
A slight modification of the MEAN stack, the MERN stack is also pretty popular. This stack uses the React framework instead of Angular for the frontend. The other components of the stack (i.e., MongoDB, Express, and Node.js) are the same.
Software stacks don’t necessarily need to contain all of the components we’ve just mentioned. For example, the MEAN and MERN stacks are not limited to a single operating system but can run on all three major operating systems (Linux, macOS, or Windows) thanks to the platform independence of Node.js.
The frontend stack—consisting of the basic web technologies HTML, CSS, and JavaScript—is so important for frontend development that it is no longer even explicitly referred to as a stack.
Now that we’ve clarified the term software stack, let’s turn to what exactly full stack means, what full stack developers are, and what they do.
The term full stack covers the complete stack (i.e., both the backend stack and the frontend stack). So, a full stack developer is someone who develops both the backend and the frontend or someone who is equally comfortable with backend technologies and frontend technologies.
Full stack developers are therefore true all-rounders: They can implement both a web interface with HTML, CSS, and JavaScript and a web service that runs on the server side and processes requests from the client. They can also select the right database to meet specific requirements and also know how to prepare the entire application for use in production systems, as shown in Figure 1.12.
Figure 1.12The Many Requirements of Full Stack Developers
Let’s quickly look at the types of roles that can occur in a web project (exclusively regarding development):
Frontend developersCan build complex web interfaces using HTML, CSS, and JavaScript and, at best, has design experience. Should also be familiar with frontend libraries and frameworks such as Angular, React, and Vue; be able to use the relevant tools such as WebPack or Babel; and know how to use CSS preprocessor languages.
Backend developersCan develop complex application logic for the server side and make this logic available via web services, for example. Should know web service Application Programming Interface (API) design and which databases are suitable for which purposes.
DevOps specialists DevOps is made up of the terms development and operations and combines these two areas of activity into one role, the DevOps specialist (or DevOps for short). The tasks of DevOps specialists thus include, for example, deploying applications for production systems, configuring build systems, and administering web servers. In addition, DevOps specialists are also often familiar with topics like web application security and performance.
In a best case scenario, a full stack developer fulfills all of these requirements and combines the three roles in one person to a certain extent. Acquiring this breadth of knowledge is not an easy task and often requires years of experience.
Our discussion of the requirements for frontend developers, backend developers, and DevOps is by no means exhaustive, and even within these three groups, further specialization is possible, such as database specialists, frontend designers, user experience (UX) designers, testers, and more.
Due to the wide range of possible requirements, however, many full stack developers quickly run the risk of being “only a little bit good at everything, but not quite good at anything.” This is then contrasted by the specialists who have specialized precisely in a particular area. A database specialist usually knows databases better than a full stack developer; a frontend designer probably knows the various CSS tricks necessary to implement a layout exactly according to a template. A DevOps specialist, in turn, is usually more effective at working with the command line and at managing servers than a full stack developer.
In large companies or large software projects, entire teams frequently exist for different areas of the stack. One team might take care of the database, another might be responsible for the frontend design, a third team might manage the implementation of the design into a concrete web interface, and so on. Full stack developers are therefore often needed especially in smaller companies or start-ups, which can (or must) often react in a more agile and flexible manner to changing requirements.
You can’t become a full stack developer overnight, and even working through a thick book like this one won’t make you a full stack developer. Rather, the goal of this book is to provide an overview of a broad range of topics important to full stack developers. This book is designed to guide you to becoming a developer who is familiar with many technologies, both backend and frontend, and to some extent DevOps. Whether you then want to call yourself a “full stack developer” is up to you.
The total of 23 chapters can be roughly divided into three sections: Chapters 1 through 11 deal mainly with general basics and topics from the frontend area, and Chapters 12 through 17 deal with topics that are mainly related to the backend area. Chapters 18 through 23 deal with topics that are relevant to both the frontend and the backend, such as testing, security, deployment, and the management of web projects.
This part of the book is organized in the following way:
In Chapter 1, you’ll get to know (or have already learned) the most important basics.
In Chapters 2 through 4, I’ll describe the three major languages of the web in detail.
In Chapter 5, you’ll learn which protocols are important in the context of web applications and when each is used.
In Chapter 6, you’ll learn about various formats that are important for implementing web applications.
Chapter 7 introduces you to a selection of web APIs for JavaScript, which are program-based interfaces that can be controlled through JavaScript.
In Chapter 8, I’ll show you what you should consider when it comes to web page accessibility.
Chapter 9 describes tools to help you make your CSS code more concise.
In Chapter 10, a guest author for this book, Sebastian Springer, shows you what single-page applications are and how you can implement them using the React JavaScript library.
In Chapter 11, you’ll learn about different types of mobile web applications.
This part of the book is structured in the following way:
Chapter 12 introduces you to several web architectures that form the basis for most web applications.
In Chapter 13, we’ll turn to the various programming languages used on the server side. I’ll show you what types of programming languages exist and which are relevant for implementing web applications.
Based on Chapter 13, Chapter 14 describes how to run JavaScript on the server side using the Node.js runtime.
For Chapter 15, another guest author for this book, Florian Simeth, introduces you to the PHP language.
In Chapter 16, you’ll learn what web services are and how to implement them.
Chapter 17 provides everything you need to know about databases as a full stack developer.
This part of the book focuses on the following topics:
In Chapter 18, you’ll learn how to automate web application testing.
In Chapter 19, I’ll show you how to prepare web applications for production use, that is, how to “deploy” them.
Chapter 20 describes considerations related to web application security and how to prevent vulnerabilities and security gaps.
In Chapter 21, we’ll look at how you can optimize the speed and performance of your web applications.
In Chapter 22, you’ll learn how best to manage web projects and organize their versions.
Chapter 23 describes different types of project management and goes into a little more detail about the Scrum process model.
The book is rounded out by several appendices for overviews of HTTP (Appendix A) and HTML (Appendix B) as well as information and command references for the tools used in this book (Appendix C).
To highlight how each chapter fits in thematically with the whole book, you’ll find a kind of roadmap at the beginning of each chapter, with the topic discussed in each chapter highlighted. Some topics are on the client side (for example, HTML or web APIs), and others on the server side (for example, web services and databases). One topic is in between (web protocols), and others—the cross-disciplinary topics—are on both sides.
Figure 1.13 Classifying the Different Topics in this Book
For web application development, you need the right tools to make your work easier. Without the right tools, development would be a lot more time consuming. Throughout this book, I’ll provide tips in this regard. At this point, however, I want to introduce you to the basic tools you absolutely need for development:
Editors: Even if a simple text editor is basically sufficient for developing web applications or implementing the associated source code, I recommend you install a good editor that supports you in writing source code and that is specifically designed for development. Code editors can, for example, highlight the source code in colors (syntax highlighting), relieve you of typing with recurring source code modules, recognize syntax errors in your source code, and much more.
Development environments: Simply put, these powerful code editors provide common features like syntax highlighting but also advanced features such as integrated debugging tools, version control, and so on.
Browsers: Of course, a browser is required for testing web applications. In particular, the developer tools available in most browsers have become indispensable parts of a web developer’s toolbox.
Meanwhile, a whole range of good code editors are available for the development of web applications. Particularly popular are Sublime Text (www.sublimetext.com, shown in Figure 1.14); Atom (https://atom.io, shown in Figure 1.15); and Brackets (https://brackets.io). All of these editors are available for Linux, Windows, and macOS. Basically, the editors I’ve mentioned are quite similar, so which you adopt depends mainly on your personal tastes. Try out several to find which one appeals to you the most.
Figure 1.14 The Sublime Text Editor
Figure 1.15The Atom Editor
More powerful than editors are development environments, often called integrated development environments (IDEs). Compared to a normal editor, development environments have special features for the development of software, such as synchronization with a version control system, the execution of automatic builds, or the integration of test frameworks. If one of these features is not installed by default, usually a corresponding plugin is available.
Well-known examples of development environments specifically for web application development include Microsoft Visual Studio Code (VS Code; https://code.visualstudio.com, shown in Figure 1.16) and WebStorm by IntelliJ (www.jetbrains.com/webstorm, shown in Figure 1.17).
A good overview of plugins available for VS Code can be found at its official website at https://marketplace.visualstudio.com/vscode.
Figure 1.16The VS Code Development Environment
Figure 1.17 The WebStorm Development Environment
To display a web page or HTML document that you’ve created in an editor or a development environment, you’ll need a web browser. An essential component of a web browser is its rendering engine, which enables you to visualize HTML, CSS, and JavaScript.
Since the rendering engines of individual browsers differ in detail (i.e., sometimes resulting in different visualizations), you should always test a web page on several browsers.
The five most popular browsers are the following:
Google Chrome: https://www.google.com/chrome (shown in Figure 1.18)
Mozilla Firefox: https://www.mozilla.org/firefox (shown in Figure 1.19)
Safari: https://support.apple.com/downloads/safari (shown in Figure 1.20)
Opera: https://www.opera.com (shown in Figure 1.21)
Microsoft Edge: https://www.microsoft.com/edge (shown in Figure 1.22)
Figure 1.18 Google Chrome (macOS)
Figure 1.19Mozilla Firefox (macOS)
Figure 1.20 Safari (macOS)
Figure 1.21Opera (macOS)
Figure 1.22 Microsoft Edge (macOS)
Besides these “big five” browsers, quite a few others exist. Most notable are Microsoft’s (aging) Internet Explorer (the predecessor of the faster Microsoft Edge browser), which—to the chagrin of many developers—is still used by some companies today, and Brave (https://brave.com), which was initiated by Brendan Eich, the inventor of the JavaScript language. If you’re interested, you can find an extensive list of other alternatives at the links to Wikipedia pages mentioned in the box.
For an overview of the distribution of browsers, see https://en.wikipedia.org/wiki/Usage_share_of_web_browsers. As of today (February 2023, with StatCounter statistics from December 2022), Chrome is by far (71.2%) the most used browser, followed by Safari (15.1%), Microsoft Edge (3.7%), Firefox (3.0%), and Opera (1.3%). You can also compare various browsers based on criteria such as range of function, support for web technologies, etc. at https://en.wikipedia.org/wiki/Comparison_of_web_browsers.
To determine which browsers use which rendering engines, see https://en.wikipedia.org/wiki/Comparison_of_browser_engines. In this context, we recommend reading “How browsers work: Behind the scenes of modern web browsers” at https://www.html5rocks.com/de/tutorials/internals/howbrowserswork, which explains in detail the functionality of browsers and rendering engines.
Which browser is the “right one,” that is, which one you should use, depends on various factors:
Customer requirements Does the customer have any special requirements? Often, you’ll encounter rather specific requirements about which browsers a web application must work for. Now and then—don’t panic—this requirement can involve Internet Explorer.
Features Do certain features need to be supported? The individual browsers (or more precisely, the various rendering engines) support different features depending on their version. Especially with the abundance of web APIs now available, the individual engines will differ. For a good overview of whether a feature is supported, check out the website https://caniuse.com.
Functional scopeBy now, all major browsers offer a similar range of functions. Of particular interest to developers are the developer tools, which you can use, for example, to adapt HTML and CSS or execute JavaScript for a web page that has already been rendered.
In this chapter, you learned the most important basic concepts important for the rest of this book. To conclude this chapter, I’ll provide an overview of the most important points and offer a brief outlook on what to expect in the following chapters. I’ll do this kind of retrospective at the end of each chapter.
The following key points were presented in this chapter:
Web pages, websites, and web applications consist of two parts: one that runs on the client side (the frontend) and one that runs on the server side (the backend).
The address you enter in the browser’s address bar is called a Uniform Resource Locator (URL).
Every web server has a unique address through which it can be reached, the IP address, which is in IPv4 or IPv6 format.
Domain Name System (DNS servers) map host names to IP addresses and return IP addresses for web servers associated with specific host names.
The following languages are especially important in web development:
Using Hypertext Markup Language (HTML), you can define the structure of a web page via HTML elements and HTML attributes and determine the meaning (the semantics) of individual components on a web page.
The Cascading Style Sheets (CSS) style language uses CSS rules to design how the individual components that you have previously defined in HTML should be displayed on the screen.
You can add dynamic behavior to a web page using the JavaScript programming language.
A software stack or stack is a concrete selection of certain components that together form a platform with which an application is developed and operated.
For web applications, several well-known stacks are available such as the LAMP, WAMP, MAMP, MEAN, and MERN stacks.
Full stack developers are familiar with all areas of a stack and combine the roles of frontend developer, backend developer, and DevOps.
A full stack developer’s toolbox consists of an editor or a development environment, one or more browsers (in different versions), their browser developer tools, and other tools that we’ll introduce later in this book.
This book is divided roughly into three parts, and in the following chapters, I’ll discuss the most important languages of the web. The next chapter starts us off with HTML.
Along with the Cascading Style Sheets (CSS) style language and the JavaScript programming language, the Hypertext Markup Language (HTML) is one of the three major languages important for frontend development.
In this chapter, you’ll learn about the HTML language, which is used to define the structure of web pages.
Figure 2.1 HTML, One of Three Important Languages for the Web, Defines the Structure of Web Pages
I don’t want to dwell on the history of HTML too long. Instead, let’s get into the language itself as quickly as possible with just a brief overview of the major versions of HTML.
A complete history of HTML, as well as all the different version numbers and release dates, can be found at https://en.wikipedia.org/wiki/HTML, for example, However, for a quick overview, let’s briefly touch upon following versions:
HTML: The first version (without a version number) was published in 1992 and was based on proposals that Tim Berners-Lee (the inventor of HTML) had already worked out in 1989 at the European Organization for Nuclear Research (CERN).
HTML 4.0: Released in 1997 and important because CSS became available in this version (see Chapter 3).
XHTML 1.0: With the appearance of the Extensible Markup Language (XML), described further in Chapter 6, the HTML language was reformulated according to XML rules. These rules are more strict than those of HTML 4.0; for example, attributes can only be written in lowercase and must always have a value (Section 2.1.2).
HTML5: This version was released in 2014 and replaced previous versions of HTML (and XHTML). HTML5, intentionally written with the version number right after “HTML,” introduced a number of new functionalities as well as numerous new web Application Programming Interfaces (APIs), which we’ll discuss in more detail in Chapter 7.
Like many other standards on the web, HTML is maintained by the World Wide Web Consortium (W3C). For a long time, the W3C attached great importance to adopting stable specifications for various standards, which, however, was not conducive to further development of the HTML standard and unnecessarily delayed progress. As a response, various browser manufacturers founded the Web Hypertext Application Technology Working Group (WHATWG), which then regarded the HTML standard as a “living specification” (living standard) and has since continued to develop HTML without a concrete version number (see https://html.spec.whatwg.org/). Meanwhile, however, the W3C and the WHATWG have agreed on further development of the standard and are now collaborating on the Living Standard.
As mentioned in Chapter 1, you can use HTML to define the structure of a web page as well as the meanings (the semantics) of individual components on a web page. Similar to word processing programs like Microsoft Word, you can highlight text, define headings, include images, create lists, and generate complex tables.
To define these components, you’ll use elements (HTML elements), which in turn can be individualized via through attributes (HTML attributes). Listing 2.1 shows a relatively simple web page: Notice how each element consists of an opening tag and a closing tag. The opening tag introduces an element, and the closing tag ends the element. For example, the opening tag <h1> introduces a first-level heading, and the (closing) tag </h1>