Friday, September 11, 2015

Book Review: Practical Web Development

Does it seem like I am starting off a lot of my posts lately with an apology? If so, it's because it feels like I've fallen off the wagon of things I should be doing (and stopped doing) because life interfered. One of those areas is the book reviews I pledged I would do more of this year. It's gotten so bad that I had to basically tell a number of publishers to hold off on titles they send to me until I can get through my back log. Don't get me started on the figurative stack of Python books I'm looking at right now (I can't say literal because they are PDF's, but trust me, there are a lot of them!). Also, as many of you well know, I do not do short reviews ;).

Still, the best way to get back on a horse is to just climb back on, so without any further ado...

At this point in time, programming for the web is a multi-faceted endeavor. There are so many choices and approaches that can be used, and technologies that can be called into action, that it is impossible to master them all. Gone are the days of basic HTML and some CGI scripts being all you’d need to deliver a web experience. Don’t get me wrong, there are still sites out there that are basically this simple, but they are outnumbered by sites that offer much greater interaction, customization and the ability to display on multiple platforms. To do that effectively, more is needed.

The challenge with most web development books (or programming books of any type, actually) is that it takes several hundred pages to cover everything needed, or the books end up being lean and abstract, with the reader having to do a lot of their own research and tinkering to create examples of their own or make the samples provided work.

"Practical Web Development" by Paul Wellins (Packt Publishing) takes a slice down the middle. It doesn’t pretend it will be able to show you everything in great detail, but it does looks to give some "practical" examples with the most common elements and some exercises to work and build on. Wellins progresses from basic HTML, CSS and JavaScript to using PHP, MySQL jQuery, AJAX, History API, XML & JSON, MongoDB, Responsive Design, Foundation framework and Node.JS. Make no mistake, that’s a lot of ground to cover in 276 pages.

So how well does Paul traverse this formidable mountain range of topics?

Part One of the book focuses on the central elements of a “stack” that allows a web site to exist in the first place, and gives an overview of the technologies that work with that web server.

Chapter 1 covers THE WORLD WIDE WEB, specifically where it’s been, where it is, and where it looks to be going. It’s a whirlwind history lesson that covers a lot of technologies that we take for granted today. For the purpose of the book, the emphasis is being placed on HTML, CSS, JavaScript and PHP, with a back end database using SQL. Therefore, up front, five “languages” need to be learned to be effective and use the book. Fortunately, the amount of each language that is needed to be learned will grow with each subsequent chapter, so you get a chance to use each of them as the book professes.

Chapter 2 focuses on the basics of HTML and the most common tags used for markup of pages. Rather than give an exhaustive run down of all the tag elements, Paul gives us the ones that are the most useful and likely to be used when developing a basic site (headings, paragraphs, links, form elements tables and divs, which are best described as self contains rectangles of HTML). Paul also makes the distinction between the structure of a document (which is done with HTML) and the styling touches, which are handled in the next chapter.

Chapter 3 covers what Paul feels are the most useful aspects of CSS, which is all about the syntax that affect the overall look and feel of your pages. The structure of the box model is central to CSS and being able to manipulate the data in a variety of boxes (often the aforementioned HTML div’s) helps to keep the style elements both contained and optimally configured. A recommendation for the use of Firebug or Development Tools in your respective browser is also recommended, as there are a lot of possibilities within CSS and ways to apply them.


Chapter 4 takes us on a tour of JAVASCRIPT with a dose of Programming 101, and builds on some of the basic building blocks of of all programming languages while focusing on the core elements that make JavaScript useful in web pages and applications, specifically as a client side programming language. Variables and variable declarations are covered, manipulation of strings and numbers, operators, control flow, functions, and objects all get a brief but focused examination. The final part of the chapter talks about using the Document Object Model (DOM) and ways to work with objects, properties methods and events. Again, it’s a high level view, but one in which you feel like you can relate to what’s being presented.

Chapter 5 introduces PHP, which is a language designed specifically for server side interactions. Again, like the previous chapters, this section focuses on what most users would need to make something work on the server using PHP, not a complete rundown of the syntax. This chapter also goes through the basics of what you need to do to check if your web host is set up to support PHP and what to do if it isn’t.


Chapter 6 adds more about PHP, specifically in conjunction to working with a MYSQL database. The chapter starts with a basic understanding of databases in general ,and then MySQL in particular. It introduces the way that databases work and how MySQL fits into the web stack. phpMyadmin is covered as well, which allows you to administer a SQL database via the php utility. It also walks the user through several commonly used database commands and fundamental queries.

Part II of Practical Web Development aims to help us break away from the model of multiple pages where a few will suffice, and to get away from static pages to those that are more interactive, dynamic and responsive to the platform it is being displayed on.

Chapter 7 covers JQUERY, which is a JavaScript library that emphasizes a small footprint. It uses CSS selector style syntax that specify DOM elements. Again, the coverage is not exhaustive, but it give enough to show the general approach to using jQuery as part of your page development and the most likely to be used aspects of the library.

Chapter 8 focuses on AJAX (Asynchronous JavaScript and XML) which is really a handful of different techniques that allow for data to be retrieved in small pieces without requiring the entire web page be reloaded. jQuery has several methods that allow for AJAX to be used. $.load and $post both allow for portions of the screen to be replaced with fresh HTML, dynamically generated or programmatically placed.


Chapter 9 covers THE HISTORY API, which becomes very important when you start creating a site that is based primarily around a single page. rather than direct a user to the previous site they were on before coming to ours, the History API allows the users to navigate back to states of the page, or to allow for a bookmark URL to represent the state of the page bookmarked.


Chapter 10 focuses on using XML (extensible Markup Language) and JSON (JavaScript Object Notation) as data formats to be used as an alternative to HTML.

XML files can be seen as small databases. XML Schema defines the structure XML files, while XSLT creates stylesheets for converting XML into different formats. SimpleXML allows for paged to be created and processed using PHP. JSON is a lean format that gets processed like JavaScript objects in the browser, and therefore requires much less overhead.


Chapter 11 introduces us to MONGODB, which is a type of NoSQL (not relational) database. It’s more readily known as a document database, and it stores JSON objects that are grouped into collections. Web applications are capable of communicating with the MongoDB using PHP.
.
Part Three of the book moves away from the underpinnings of the technology and deals with methods that help the loo and feel of the users experience, regardless of the platform being used.


Chapter 12 focuses on MOBILE FIRST, RESPONSIVE DESIGN WITH PROGRESSIVE ENHANCEMENT (go ahead, say that ten times fast ;) ). The key idea is that, based on the platform it is being displayed, the page will dynamically tailor itself to display optimally for that device. Desktops, tablets and phones have radically different screens and needs, and Responsive Design aims to help with that. One of the key aspects of this chapter is to encourage you to focus on mobile development and display first, and then work back. Additionally, another JavaScript library called EnhanceJS allows for different experiences to be displayed depending on the browser being used or the platform accessing the content.

Chapter 13 introduces FOUNDATION – A RESPONSIVE CSS/JAVASCRIPT FRAMEWORK. The idea behind Foundation is that it lets us focus on developing a site without having to reinvent the wheel on the responsive part. By using a grid system, you can determine how many areas can be used depending on the size of the screen, so that the site expands and reformats based on the grid. Foundation also includes a number of UI enhancements that make it easier to put together navigation, image display and other details that make interacting with a site easier based on the available real estate.

Chapter 14 closes out the book with an introduction to NODE.JS, which is, at its core a fundamental break with all of the rest of the web development options discussed in the previous chapters. Rather than require a whole host of technologies, everything can be written within Node, which then translates everything to native JavaScript (and by extension HTML, CSS, etc.). This can be done using the Express framework, which is described in basic detail, and the idea of templating (which is what PHP does), using handlebars.js.


An Appendix section describes BOOTSTRAP - AN ALTERNATIVE TO FOUNDATION. The same exercises Paul described in Chapter 13 he tackles here, but uses Bootstrap.JS. It meets a similar goal, i.e. making a mobile-first, responsive site without having to reinvent the wheel to provide the responsive part.

Bottom Line:

The title of the book is Practical Web Development, and a special emphasis needs to be placed on the “Practical” part of the title. Paul has strived to make a book that is accessible, easy to follow, and lean enough to be usable without getting the reader lost in the weeds. I’ve long been looking for a book that would be a soup to nuts title, one that could be the starting point for someone to start with developing for the web, and have a single source to get up and running. Is this that book? It’s pretty darn close! There’s lots of additional areas that could have been covered, but to his credit, Paul has made a title that hits the high points, and a few divergences that are interesting if not mandatory. For a lean and straightforward primer on modern web development approaches, this is a great place to start.

No comments: