Missing Link: an Introduction to Web Development and Programming
Total Page:16
File Type:pdf, Size:1020Kb
The Missing Link: An Introduction to Web Development and Programming The Missing Link An Introduction to Web Development and Programming <a href=""> Michael Mendez SUNY Fredonia i The Missing Link An Introduction to Web Development and Programming by Michael Mendez Open SUNY Textbooks 2014 ©2014 Michael Mendez ISBN: 978-0-9897226-5-0 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Published by Open SUNY Textbooks, Milne Library (IITG PI) State University of New York at Geneseo, Geneseo, NY 14454 Cover design by William Jones Licensing This text is published by the Open SUNY Textbooks project under the Creative Com- mons 3.0 license format (see full length legal text at http://creativecommons.org/licenses/ by-sa/3.0/): You are free: 1. To share — to copy, distribute and transmit the work 2. To remix — to adapt the work 3. To make commercial use of the work Under the following conditions: 1. Attribution: You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). 2. Share Alike: If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. With the understanding that: 1. Waiver: Any of the above conditions can be waived if you get permission from the copyright holder. 2. Public Domain: Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license. 3. Other Rights: In no way are any of the following rights affected by the license: a. Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; b. The author’s moral rights; c. Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. 4. Notice: For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with the link given at the top of this page. To my family and friends, for supporting, encouraging, and challenging me over the years. About the Textbook Web development is an evolving amalgamation of languages that work in concert to re- ceive, modify, and deliver information between parties using the Internet as a mechanism of delivery. While it is easy to describe conceptually, implementation is accompanied by an overwhelming variety of languages, platforms, templates, frameworks, guidelines, and stan- dards. Navigating a project from concept to completion often requires more than mastery of one or two complementing languages, meaning today’s developers need both breadth, and depth, of knowledge to be effective. This text provides the developer with an understanding of the various elements of web development by focusing on the concepts and fundamentals through the examples within, providing a foundation that allows easier transition to other languages and a better un- derstanding of how to approach their work. The reader will be introduced to topics in a manner that follows most project development methods, from initial conceptualization and design through front end development, back end development, and introducing additional concepts like accessibility and security, while focusing on responsive design techniques. Each section of the text includes opportunities to practice the material and assess increased knowledge after examining the topics. About the Author Michael Mendez, M.S., is a professional web developer and professor with a master’s degree received after studying computer science, business, and communications at the State University of New York, University at Fredonia. Having worked in the information tech- nology field for over 12 years, he has provided the small to medium business market and public sector agencies with services in hardware and network installation and support, web development, systems support and maintenance, and solutions design and implementation. These experiences have involved academic, media, emergency management, non-profit, business to business, and business to consumer organizations. Reviewer’s Notes It is always a challenge to teach a course in web design or web programming. Systems that run on the World Wide Web must necessarily change with the emergence of any sort of new computer technology, creating a rapidly evolving landscape. The students that enroll in web development courses are a particularly diverse group; the subject attracts strong programmers with weak aesthetic design skills as well as those who are more aesthetically inclined with little knowledge of programming. Finally, the visibility and mission criticality of web platforms makes the design and security of these systems paramount. The Missing Link attempts to bridge the gap between these conflicting educational de- mands. While most web development texts opt to delve deeply into one or two of the tools in the belt of a web programmer, the author of this text takes a broad approach to teaching web programming and development. The result is a single resource that integrates good design practices, modern technologies, and all of the programming tools that one would need to build a successful, dynamic web site. Unlike many texts, this one begins by giving the readers a solid foundation in the tech- nology that runs the Internet along with a sense of what technology is currently coming of age. This is followed by both a process and pattern-oriented slant on web design that fo- cuses on the Model-View-Controller structure which underlies the rest of the text. HTML and CSS covered for the development of web interfaces. The PHP and JavaScript sections enable readers to develop the controllers for those interfaces. Finally, a concise introduction to databases and SQL allows for the development of robust data models. In addition to the unique combination of content found in this book, the tone is also one of practicality. The author doesn’t mince words and gets right to the point with ex- amples meant to be referenced quickly and often. Although this directness may put off some readers who prefer to read texts cover to cover, all software developers know that this is how texts are used in the real world. In the end, the broad approach that The Missing Link takes to web design and pro- gramming combined with the text’s concise presentation of information makes this a web programming text unlike any other. Robert Olson, M.S. Professor Robert Olson is a Visiting Instructor of Computer & Information Sciences at the State University of New York at Fredonia where he teaches courses in computer programming, computer security, mathematics, and artificial intelligence. He also teaches Microcomputer Ap- plications at Jamestown Community College. Professor Olson received a Master of Science in Management Information Systems from SUNY Fredonia on May 2007. About Open SUNY Textbooks Open SUNY Textbooks is an open access textbook publishing initiative established by State University of New York libraries and supported by SUNY Innovative Instruction Technology Grants. This initiative publishes high-quality, cost-effective course resources by engaging faculty as authors and peer-reviewers, and libraries as publishing infrastructure. The pilot launched in 2012, providing an editorial framework and service to authors, students and faculty, and establishing a community of practice among libraries. The first pilot is publishing 15 titles in 2013-2014, with a second pilot to follow that will add more textbooks and participating libraries. Participating libraries in the 2012-2013 pilot include SUNY Geneseo, College at Brock- port, College of Environmental Science and Forestry, SUNY Fredonia, Upstate Medical University, and University at Buffalo, with support from other SUNY libraries and SUNY Press. For more information, please see http://opensuny.org. Table of Contents About the Textbook v Preface xii Section 1: Web Development 1 Chapter 1: Brief History of the Internet 2 Chapter 2: Current Trends 4 Chapter 3: Web Servers 13 Chapter 4: Network Basics 19 Chapter 5: Website Design 25 Chapter 6: Development 38 Section 1 Assessments 54 Section 2: Document Markup 60 Chapter 7: Markup Languages 61 Chapter 8: Creating HTML Files 66 Chapter 9: Page Layout 68 Chapter 10: Text Layout 73 Chapter 11: Navigation 81 Chapter 12: Graphics 84 Chapter 13: Tables 88 Chapter 14: Forms 91 Chapter 15: Canvas 94 Chapter 16: Media Support 104 Chapter 17: Mobile Device Support 107 Chapter 18: Tags to Avoid 108 Chapter 19: Rule Structure 109 Chapter 20: Layout Formatting 119 Chapter 21: Font and Text Decoration 132 Chapter 22: Responsive Styling 136 Section 2 Assessments 142 Section 3: Scripting Languages 148 Chapter 23: Server-Side and Client-Side Scripting 149 Chapter 24: Creating PHP Files 152 Chapter 25: PHP Errors 153 Chapter 26: PHP Output 156 Chapter 27: Data Storage 158 Chapter 28: Data Manipulation 167 Chapter 29: Email 173 Chapter 30: File Interaction 176 Chapter 31: Structures 179 Chapter 32: Functions 186 Chapter 33: Objects and Classes 191 Chapter 34: JavaScript Syntax 194 Chapter 35: JavaScript Examples 198 Chapter 36: jQuery 202 Section 3 Assessments 205 Section 4: Persistent Data Storage 210 Chapter 37: Database Types 211 Chapter 38: Data Relationships 216 Chapter 39: MySQL Data Types 218 Chapter 40: Normalization 221 Chapter 41: MySQL CRUD Actions 231 Chapter 42: Advanced Queries 240 Section 4 Assessments 244 Section 5: Tying it Together 248 Chapter