Introduction
Easy to Use
Normally, putting honey in my tea is not a particularly demanding task, but that morn-
ing my hand was pa ralyzed in astonishment, trying to do its rou tine job of pouring
some honey in the steaming cup . Honey labels usually say things like All Natural,
“Contains Antiox idants, or “With Grandma’s Recipe Book. O ver tim e, I’ve got used
to mor e absurd labels like “Improved New Flavor” or “Gathered by Real Bees. The
label that knocked me out was surprisingly plain, with an award-winning message
printed o n it: “Easy to Use. I don’t recall honey ever being hard to use, except maybe
when it c rystallizes, or when I was six months old, but that’s probably not exactly
what the author of the message had in mind.
You can also buy program ming books that promise easy an d quick learning, even as
fast as in 24 hours. An average adult can read a novel in 24 hours. But let’s face it, no
one can rea d—let alone understand and learn—a 500-page technical book in 24 hours.
While using honey is not dicult even when it doesn’t explicitly say so, learning to
progr am is not easy. It can be fun if you’re motivated and have decent mate rial to
study from, but it’s also a n eort. If youre not ready to accept that, then this book
is not for you. Otherwise, I invite you to join Maria, Mike, and me at exploring the
exciting world of computer programming. It’s going to be fun but it’s also going to be
some work.
About the Book
This handbook is a manual for undergra duate students of engineering and natural
science fields written in the form of a dialo g between two students and a professor
discovering how computer programming works. It is organized in 1 3 thematic meet-
ings with explana tions an d discussions, sup ported by g radual evolution of engaging
working examples o f live web documents and applica tions using HTML, CSS, and
JavaScript. You will see how the three mainstream languages intera ct, and learn some
of the essential practices o f using them to your advantage. At the end of eac h meeting
there is a practical h omework, which is always discussed at the beginn ing of the next
meeting. There is also a list of related keywords to help you review important topics
xiii
of each meeting.
The general struc ture of the book is multilayered: the basic language syntax and rules
are fleshed out with contents and structure while still keeping things simple and man-
ageable, something that m any intr oductory textbooks lack.
The main body of the text is accompanied by five appendices. The first of them con-
tains a solution of the last homework, the second summarizes (also with examples)
some major directions in which you can continue your stud y, including hints on some
of the relevant sources. The last th ree appe ndices are abbreviated references of the
three languages used in the book.
There will be situations when yo u need to use yet more languages and technologies in
order to get the job done. Some such situa tions are gently dealt with in th is book. For
example, you will learn just enough ab out a Server Side Includes language to be able
to include external HTML code, which will save you a tremendous amount of time
and energy.
Is This Book for Me?
If you know absolutely nothing about compu te r programming a nd want to learn, this
is the book for you. It has been wr itten with a comp le te b egin ner in mind in the first
place.
If yo u have been exposed to programming before, you m ight find the book useful
as well. Today, many people learn from examples and forums, and thus acquired
knowledge is mostly skills and not much theory. If you ever want to build more
serious software, you need a firm and systematic understanding of w hat is going on.
You need a framework to wh ic h you can sy stematically attach your partial skills to
form a sound structure of co nnected knowledge. Hopefully, this book can give you
this as well.
Last but not least, if you’re a teache r of an introductory programming course, you
might find a handful of usefu l examples and approaches for your classes on the few
hundred pages that follow.
But most likely, as there are as many learning styles as there are learners, you will
have to find out for yourself whether or not this book is for you.
How to Avoid Reading the Whole Book
Don’t panic! If you are only up to JavaScript programming, you can just read Me eting
1 to get a basic idea of what HTML is (you need this in or der to be able to run the
JavaScript examples in this book), and then you can immediately skip to Meeting
6—more specifically, Section 6.3. There are some examples involving CSS in the
JavaScript part but they won’t stand in the way of your learning JavaScript. Later, if
you feel like it, you can just as well skim over Meeting 3, where you can get the basic
idea of what CSS is all about.
xiv Introduction
For Your Safety
This book is not about cutting-edge web technologies, so you don’t need any pro-
tective equipment. It is more abo ut general c omputer programming and some web-
related principles using the mainstream web languages HTML, CSS, and JavaScript
as examples. So me of the principles are over 40 year s old, but are extremely important
because they allow you to write cleane r and more easily maintainable code, and they
will not go away just like that.
It’s a busy world, and the sixth edition o f ECMAScript standard (the standard iz ed
version of JavaScript) has just entered the ocial pub lication process. The good news
is that it o nly introduces additions to its predecessor, so the essential concepts stay.
Also, while CSS3 isn’t completely finished yet, there alread y exist some so-called
“level 4” CSS modules. Fortu nately, they are also just additions to the CSS standard
and there are no serious plans for a single CSS4 spe cification on the horizon. This
book pays attention to the basic co ncepts that have matured with the latest HTML5,
CSS3, an d ECMAScript 5 stan dards to the point where it seems these concepts are
going to persist for some time.
The Software Used
In r esearching this book, I used Google Chrome and N otepad++ v6 .5.3 (notepad-plus-
plus.org
) on a Windows 7 Profession al SP1 64bit operating system. I also used the
EasyPHP DevServer 13.1 VC11 web development server (
www.easyphp.org). How-
ever, you will be able to follow most of the examples and experiments in this book
using any modern browser and plain text editor. They are already installed on your
compute r, so you can start experimenting right away.
Conventions Used in This Book
The following typographical conventions are used in this book:
A monospaced font is used for all code listings and everything that you normally
type on a keyboard, including keys and key combinations.
A monospaced italic font is used as a general placeholder to mark items that
you should replace with an a ctual value or expression in your code.
An italic font is used to indicate the first appearance of a term, or as an emphasis.
A sans serif font is used to indicate a menu item.
A sans serif ital ic font is used to indicate URLs and file names and extensions.
Feedback and Supporting Online Ma terial
I deeply a ppreciate having any comments, suggestions, or errors found brought to my
attention at the email address
start-programming@fajfar.eu. You will find source c ode
of the example s in this book and some additional materials an d problems for each
chapter at
fajfar.eu/start-programming.
Introduction xv
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.36.166