Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Friday, January 17, 2014

Taking A Different Approach To JavaScript

I enjoyed my Codecademy experience in learning JavaScript, but especially toward the end, I felt like I was having to look up things constantly. I posted a query on their forums and got a very nice response back from one of the mods explaining that this was perfectly normal. He suggested retaking the course to help cement the new concepts and haunting the Q & A forums for more info. In the meantime, I found something else.

Interestingly enough, I found out in one of the Codecademy Q & A's about a site called JavaScript.is (Sexy). It sounds like a silly name, but I think it's actually going to be the solution to my situation. They have an eight week tutorial that I just began titled How to Learn JavaScript Properly.

There's a textbook involved, and they recommend a related reddit study group, signing up for Stack Overflow and, interestingly enough, using Codecademy for practice.

You can click the link I provided to see all of the requirements for the class, but I like the organization and structure involved. It also provides me with the format for repeating the Codecademy JavaScript course as well as adding more content via the other class elements.

Since this is a work requirement, I need to stick with it and I guess that's the secret, especially for people like me who aren't "natural" programmers. I write in English everyday for a variety of purposes, professional, semi-professional, and personal, so I have plenty of practice in that arena. If I did the same with JavaScript, even though I find it less intuitive than my native written and spoken language, I can only imagine that coding in JavaScript will get a little bit easier.

I haven't forgotten HTML5 and CSS3, but I'm not sure combining that with JavaScript in the same learning effort is going to be effective. I may need a different plan for that learning path. Right now, in addition to my professional and personal life, I'm focusing on this plan.

Wish me luck.

I'll be back at some point to let you know how things are panning out.

Sunday, December 15, 2013

Ten Days Down the Road

This always happens when I start studying. I get sidetracked. My actual work started to heat up, preventing me from proceeding with the CSS book. I did receive Training Guide: Programming in HTML5 with JavaScript and CSS nearly a week ago and started noodling around in that, but didn't get too far.

I was advised this would be a good book to learn from even without working in Windows 8 and with Visual Studio (I'm not interested in the certification, just learning the information), but that means I get to skip a few chapters. The book is organized in "waves," so to speak, so you first get introduced to HTML, then JavaScript, then CSS. Later, you get more advanced information on HTML, then JavaScript, then CSS again, and so on. I'm only on page 32, so you can imagine things are still pretty elementary.

On the other hand, I did start the Codecademy JavaScript tutorial, but as usual, I got bogged down toward the end of "Introduction to Functions in JS." I've appealed for help to the forums so I guess I'll see what the error of my ways is by the by. 

I thought I was doing reasonably well there for awhile, but then the problems seemed to assume more knowledge than I had. I thought I had missed some key portion of a previous lesson and went back, working my way forward again, but it didn't help. One exercise gives me both an error and also passes me on to the next exercise, so that's confusing. On top of that, I thought my code was written exactly to specs.

The other exercise is beyond me. I don't find enough information in the instructions or the previous exercises to allow me to write code that doesn't complain at me. I know for actual programmers, these lessons would be painfully elementary, but to me, they're locked black boxes with no way in.

My real problem is that I don't naturally think like a programmer. I've read arguments back and forth on the web about whether anyone can learn to code. Sort of like the message in the Pixar film Ratatouille (2007), "Anyone can cook." 

I believe anyone can cook but not that anyone can cook well. The question remains, can anyone learn to code, even at an elementary level, or is programming a skill set for a specific population that no one outside that group can acquire? I feel like Codecademy's "teaching style" is good in that they don't just lead you around by the nose, giving you all the code upfront and then simply having you copy and paste, and then run short, small programs. On the other hand, when you get stuck, you're stuck. The hints on the last two exercises weren't helpful in the slightest.

Forums can be incredibly slow to respond, depending on how attentive the mods are, so I don't know how long I'll need to wait for a clue let alone an answer. A large part of programming is debugging, but that requires a sufficient understanding of how the code works to find the problem. I'm not there yet. The point of setting these work goals is to see if I can ever get there. Now that my job performance is riding on it, I'll have to figure out a way or be prepared (at least) to eat large helpings of humble pie.

That's my report, such as it is.

Addendum: Not that much time passed and I got two helpful responses on the forum. Turns out I made some minor, newbie errors. Oh duh. Now, back on track.

Thursday, December 5, 2013

Day Three of My Forey into CSS

After the limitations I discovered in learning CSS as part of the Codecademy Web Fundamentals track, I decided I needed something a little more in-depth. I considered another online program such as Lynda.com, but they cost bucks. OK, not a lot of bucks, but I didn't feel like bugging my boss for his credit card again, especially since I already made him buy me this book.

So I decided to look through some of the other books I've collected over the years and have been ignoring, and I selected this book from 2009. Yes, I know there's a more recent edition available, but this one is in hand right now, so why wait? It seems enough to get me started and I'll have a leg up on CSS by the time the other book arrives.

The question now is whether or not to just concentrate on CSS or to do as Codecademy previously (through automation) suggested and move on to JavaScript via their tutorial? Interestingly enough, that track is telling me that I finished the first section in Introduction to Programming. I hadn't realized I'd let so many of these tasks incomplete until revisiting the site of my old haunts, or perhaps I should call them "my old sins."

I suppose it wouldn't hurt to at least see what I was supposed to have learned in the distant past. Especially since the book I ordered from Amazon yesterday addresses HTML5, CSS3, and (drumroll) JavaScript.

The CSS book I'm using at the moment is rather slow going, but it's taking me over some really basic stuff I went through at Codecademy, and I could probably use the review to continue cementing this into my leaky memory. Oh, I installed the TextWrangler code editor on my Mac at work. Not the greatest tool I've used, but it's free and does a descent job. I really miss how the online editor at Codecademy worked. You could toggle back and forth between the HTML and CSS tabs to do the editing, but the Results window instantly showed your changes. Beats having to continually refresh a web browser.

I find it interesting that after ignoring this blog for over a year, I should be writing daily blog posts here. Go figure.

Friday, August 17, 2012

Codecademy Revisited

I recently received an email notice in my inbox "Announcing Python at Codecademy". Well, it's about time. I reviewed codecademy's learn to program tutorial about a year ago (featuring JavaScript), but the lessons ended and there was no place to go, so I stopped visiting their site.

A year passed and I pretty much forgot about Codecademy until I received their email. Curious, I decided to browse the site.

The home page looked the same as I remembered it. "Learn to code". "Get Started (it's free)". I clicked the big, green button and the page dimmed except for the field with the active cursor and the prompt to type in your name with "quotes" around it. I was taken through the beginning of the JavaScript module, the "teaser" for the course, by putting in my name, finding out its length, and doing some elementary math computations. Once I got through the intro, I was prompted to start the next section.

What I was trying to find out is if the JavaScript tutorial had gotten past "while loops". It was difficult to tell what the whole JavaScript course consisted of since each lesson forces you to go step-by-step rather than skipping ahead. As far as I could tell, the JavaScript tutorial had been significantly re-worked and ended on variables after about five sessions.

I wasn't interested in going through the JavaScript tutorial at that point and clicked the "Learn" button at the top of the page. What I found was that after a year, Codecademy has a lot more to offer:

  • JavaScript Fundamentals
  • Python
  • Web Fundamentals
  • JQuery
  • Code Year

It didn't look like the different offerings were necessarily interdependent, but you could go through the JavaScript Fundamentals course and then hit Web Fundamentals to learn HTML and CSS, progress through JQuery as your JavaScript library, and then conclude with Code Year to learn how to build websites with JavaScript. I know Python doesn't seem to fit the path, but it is (or seems to be) the newest module as it's "beta" tag discloses.

It will take a little time go to through a significant portion of the tutorials in order to learn enough to update my original review, but I did want to let anyone reading this know that Codecademy is back on my radar after a year.

I'll post subsequent blogs and let you know what I think about the details.

Saturday, December 3, 2011

Review of CoffeeScript: Accelerated JavaScript Development

It's been awhile since I've sunk my teeth into a good book review so I'm finally glad to get my appetite back and start consuming Trevor Burnham's CoffeeScript: Accelerated JavaScript Development book. I'm actually just as interested in trying out CoffeeScript itself as in having a look at what the book has to offer. Well then, let's get started.

First off, before even getting into the book, what is "CoffeeScript"? For a quick and dirty definition, I hit up Wikipedia:
CoffeeScript is a programming language that transcompiles to JavaScript. The language adds syntactic sugar inspired by Ruby, Python and Haskell to enhance JavaScript's brevity and readability, as well as adding more sophisticated features like array comprehension and pattern matching. CoffeeScript compiles predictably to JavaScript and programs can be written with less code (typically 1/3 fewer lines) with no effect on runtime performance. Since March 16, 2011, CoffeeScript has been on GitHub's list of most-watched projects.
I suppose I could say that if you don't know what CoffeeScript is, you shouldn't be reading Burnham's book, but that's probably not true. According to the "Who This Book Is For" section in the Preface:
If you're interested in learning CoffeeScript, you've come to the right place! However, because CoffeeScript is so closely linked to JavaScript, there are really two languages running through this book - and not enough pages to teach you both. Therefore, I'm going to assume that you know some JavaScript."
The author goes on to say that even if you know just a bit of JavaScript, you should be OK, but rank novices at the language might want to get to know a bit of JavaScript before tackling CoffeeScript. Also, since Ruby inspired a lot of the features in CoffeeScript, having a bit of Ruby background is a plus.

A couple of other "support" features before diving into the book and CoffeeScript. The sample code used in the book can be found on the book's official page at Pragmatic along with links to the errata, the discussion forums and of course, how to buy the book in hardcopy, ebook, or both formats.

How to get CoffeeScript.

I chose to use Ubuntu for my "testing platform" but was running Ubuntu's last LTS version, which doesn't support installing CoffeeScript, even in an exceptionally painful manner. Therefore, I upgraded my Ubuntu box to 11.10 (Oneiric Ocelot), opened the Ubuntu Software Center, and searched for CoffeeScript. It was discovered in no time and I installed it with no difficulty. Notice that this means I completely blew off the instructions for installing CoffeeScript as found in the first chapter, but since the book was published last August and the production version of 11.10 didn't become available until October, I figured, "what the heck". We'll see if my impatience will come back to bite me in the rear.

So now I have CoffeeScript. How am I going to use it? Oh, yeah. I have this book.

Anxious to "meet coffee", I opened a terminal window and just for giggles, typed "coffee -v" to see what version I had. So far, so good, I have version 1.1.1, the same version used in the book (the latest version as I write this blog post is 1.1.3).

There are all kinds of text editors you can use with CoffeeScript, but the author, apparently being a Mac guy, prefers textmate. Fine and dandy, but I use Ubuntu and prefer Vim. Apparently, there are textmate plugins for a wide variety of text editors including Emacs, gedit, jEdit, and of course, Vim. You can choose to go through the time and effort of adding the plug-in but you don't have to. As it says in the book, any text editor will do.

I have to say two very good things about this book. First off, the author obviously knows CoffeeScript. This is evidenced by the apparent ease at which he explains the concepts and the whirlwind tour he takes the reader through. The whirlwind tour is the second good thing since the reader gets started programming right away and dives into a practical project. If you are a beginning web developer, this book is well suited to your experience level. Unfortunately, for the beginner (and probably more advanced readers), the book has some drawbacks. I'm not sure Burnham knew exactly who to write the book for. At some points, you need to understand some JavaScript to know what's going on and at others, the author goes to some length to explain aspects of HTML and CSS (which I would presume the reader should know if they're taking on a web development programming language).

I don't mind books for beginners and in fact, I encourage them, and as an author, I can certainly understand when a publisher asks that you limit your page count to under 150 and thus limit the scope of your book, but it's as if Burnham couldn't decide how to best make use of his 138 pages. While it's good not to overwhelm novice programmers with a lot of details, beginners also tend to get confused easily if tasks and concepts are not sufficiently explored. Based on his writing style and presentation, it seems like Burnham is probably a very likable and knowledgable person, so I hate to give his book a less than stellar rating, but with CoffeeScript, JavaScript as well as jQuery, HTML, and CSS all tossed into the middle of the salad, it was hard to see the overall focus of this small text.

I do like that the book devoted itself to creating a single product (a simple game) throughout the chapters and allowed the reader to make and refine this game as a way to learn basic CoffeeScript, but in my opinion, the book is as frustrating as it is illuminating. If you're interested in learning CoffeeScript and you have at least a little programming experience, I won't say not to buy Pragmatic's CoffeeScript book, but I would recommend also spending a lot of time at coffeescript.org which, in and of itself, isn't a bad way to learn this language.

Wednesday, August 31, 2011

Learn to Program Online at Codecademy.com

My friend Judah Himango suggested that I look at the Codecademy.com site. It's just about the easiest way to learn JavaScript anyone could imagine, and it's relatively fun, too. There is a bit of a hook involved. Although you can start the lessons without creating an account, after a few lessons, you are offered the opportunity to either create an account (it's free) or lose your work to date. I created an account.

Once I did, I could continue with the lessons, quit with I got tired/bored (my work was saved automatically), and then sign in later to continue with my saved work. On signing in, you are shown a summary of the lessons you've completed and which ones you have yet to start. After you successfully finish so many lessons, you "earn" achievement badges. For making it through the first four of eight lessons, I earned two achievements.

The lessons are fun, easy, but inflexible. If you deviate from the lesson in the slightest way, you will get an error message. While a hint is provided with different steps in each lesson, if you get stuck, you don't get any other help except to offer feedback about the lesson. There's no way to just get the full solution presented to you. That's good on the one hand, because you aren't tempted to give up too easily and it "forces" you to try and figure out what went wrong. On the other hand, it you truly get stuck...you're stuck. Lessons build on one another (which is a good idea) so if you can't figure one part of a lesson out, you won't be able to just skip it and move on.

The scope of the course, "Getting Started with Programming", only spans eight lessons, ending after the lesson on "while loops". There's no obvious way for me to tell after lesson eight if I'll be able to continue with what I've started to learn. I clicked the "Courses" link in the header menu expecting to see extended (possibly for pay) courses, but all that appeared was the eight lessons for the basic course.

Once you log out, you're returned to the start page. The other options on that page include subscribing to an email newsletter, and sharing your experience with your lessons on twitter and Facebook. Presumably, this is part of how Codecademy plans to market itself. Oh, there is a section called "Create a Lesson", so the Codecademy folks are interested in external participation in expanding their project.

Codecademy seems like it's a project in the making. Since they harvest your email address, both as a condition of creating an account, and during the pre-account lesson when you're asked to enter your email address, I expect that once Codecademy has a sufficient database of names, they'll advance to the next phase of whatever their plan happens to be. That could either mean further lessons will be for a fee or they may continue to offer more advanced lessons without charging.

I'm hardly the first blogger to post a review. About two weeks ago, TechCrunch published their write up on Codecademy, including a talking to Codecademy co-founders Zach Sims and Ryan Bubinski. Sims commented several times on the TechCrunch blog including, "Hi everyone - we might be a little slow right now but we're working on getting things faster. Thanks so much!"

Other thoughts: The "subtitle" of the course "Getting Started with Programming" is "Time to become a coding ninja". That sounds as if Codecademy's intent is to encourage its students to become proficient and even expert at coding. Three things will have to happen. The first one is obvious. They'll need more lessons. A lot more lessons.

The next two points I take from my own experience. You can't really learn something unless you do it all the time. People don't learn to read and write when they do it only occasionally. They need to practice reading and writing all of the time until it becomes second nature. Even if you teach someone the basics of programming, if they don't have any way to apply it on a frequent basis, they'll lose those skills again. Building in some form of continual practice with periodic refreshers of material covered previously will help.

Finally, students will eventually have to learn to "build" something practical. Learning how to determine the length of a string is fine and dandy, but so what? How does that figure into writing a program that actually does something? Lessons will eventually have to lead to practical projects so that at some point, the students will be able to program independently.

Of course, the real power in any programming language is its libraries, so learning JavaScript will have to turn into something like learning jQuery. Another things to consider is whether or not JavaScript will be the only programming language Codecademy chooses to teach. A lot can be done with JavaScript but hardly everything. A server-side language such as PHP might make a good addition. Beyond that, it just depends on what sort of long-term goals Codecademy has for its project.

Presently, although Codecademy has gotten a lot more attention than they expected in the short amount of time they've been online, I'm sure they'd love more. If you know little or nothing about programming but would like to learn in an interactive environment, go to Codecademy.com and try it out.

Wednesday, February 2, 2011

Pragmatic Guide to JavaScript

Author: Christophe Porteneuve
Format: Paperback, 150 pages
Publisher: Pragmatic Bookshelf; 1st edition (November 22, 2010)
ISBN-10: 1934356670
ISBN-13: 978-1934356678

So there are just billions of JavaScript books on the market and if you are interested in this language, or learning more about this language, you probably own several. Why would you want to buy the Pragmatic version? What sets it apart from the rest of the herd? What does it bring to the table?

Good questions. But can Porteneuve's book provide the answers?

According to the blurb on the back cover, the book will get you up to speed quickly and painlessly with the 35 key JavaScript tasks you need to know. Task-oriented is good. You can't learn to use a programming language without writing the programming language. I am concerned about the phrase the 35 key JavaScript tasks you need to know. How does anyone know which tasks I need?

Often, my favorite part of a book such as this is the Who is this book for section. Here is where you'll find the "official" mission of the book and sometimes where you'll find the inconsistency between the book's stated purpose and how it's actually written. Here's the first sentence:
This book is not really intended to teach you "JavaScript the language".
What? That's not the impression I got from the back cover. As the "Who is this book not for section continues, it says that the language is pretty easy on its own so, if you know any programming at all, learning the basics (loops, variables, and so on) isn't much of a chore. The book even recommends the "JavaScript Core skills" section of Opera's Web Standards Curriculum.

So who really should buy this book?

Apparently, people who already have a smattering of JavaScript knowledge (or more), but who need a set of specific solutions to common JavaScript tasks. The tasks are collected into six different parts in the book, including Pure JavaScript, The DOM, Events, and Timers, UI Tricks, and more.

Each task is generally presented in a two-page spread, with the description of the task on the left and the code samples on the right. I say code "samples", because the "finished product" isn't presented on a silver platter for the reader, hence the need to not just know, but to be familiar with programming in general and JavaScript in specific right at the onset. Thus, you can think of this book as not for the JavaScript beginner, but as the next step in a JavaScript coder's progress in learning to apply practical solutions to JavaScript problems.

This is a good thing, since most beginner's JavaScript books focus on teaching the language but don't really teach you what to do with it. It would be really cool if a publisher like Pragmatic would publish a series of books on a language, starting with a complete beginner's primer, and then producing subsequent books aimed at different skill levels and applications for the language.

JavaScript really isn't just about the language. Except for very minor tasks, in production, you almost always are using a framework such as jQuery, Dojo, or MooTools. Although this book advertises itself as "framework agnostic", it (and the author, I suppose) tends to favor ProtoType as a framework. That said, it's not an exclusive ProtoType tutorial and does offer creative solutions to what are considered common problems.

Every book has a website, and this one is no exception. The book's official site is http://pragprog.com/titles/pg_js, where you can access the sample code, review the errata, and participate in forum conversations about the book's contents (though, there are only three threads, the most recent being November 2010 as of this writing).

Like all books that present specific tasks and solutions, Pragmatic Guide to JavaScript is limited by its own parameters. That is, it won't tell you how to solve problems beyond the 35 tasks presented in the book. However, the book also helps you learn different ways (hopefully) to solve problems you may have already confronted or with which you are currently struggling. Before buying, it's probably best to scan the table of contents and see if there are enough of the kinds of tasks that you need to explore. If so, pick up a copy and have at it...and have fun.

Wednesday, December 9, 2009

What do Interpreted Programming Languages have in Common? Part II

I begin this tutorial a few weeks ago with Part I and received some very nice comments correcting my (fortunately) minor errors. This isn't a tutorial about how to program in a specific language or even really about how to program. I wanted to show the common structure of interpreted programming languages in the hopes of revealing some common threads, rather than focusing on the ins and outs of one language. I've heard it said that if you learn one langauge, it makes learning the next one easier. My problem is I get lost in the nuances of the language in question and lose track of the basic structure of programming. I've created this tutorial series to try and correct that. This tutorial is for my education as much as anyone else's so I welcome comments but, as I said before, be polite. This is about learning.

Speaking of Languages, code examples are presented in JavaScript, Python, and Ruby. I figured this represented a healthy cross-section of commonly used interpreted languages. Now, on with the show.

Controlling Program Flow, Part I

In our last episode (sorry, couldn't resist), we left off with Arrays and Booleans. The tutorial picks up with methods of flow control. According to Wikipedia, flow control is "a statement whose execution results in a choice being made as to which of two or more paths should be followed. For non-strict functional languages, functions and language constructs exist to achieve the same result, but they are not necessarily called control flow statements." In other words, it's a way of making decisions within the program given different conditions. Speaking of which:

Conditions: These statements in a program act as a decision tree or like a set of intersections in a city. The decisions or route are dependent on what conditions are or are not true (speaking of Booleans) or where you're trying to go. The basic structure of a conditional statement looks something like this:

if (condition)
{
     conditional code;
}

That's a very general example, of course, but it gives you a place to start.

if statements:
If statements are more or less the same in all three of the languages we've been working with:

JavaScript Sample Code:

var value = 0;
if (value > 0)
{
     alert("Greater than zero");
}
Python Sample Code:

n = 0
if n > 0:
     print ("Greater than zero")
Ruby Sample Code:
n = 0
if n > 0
     return "Greater than zero"
end
Of course, that's not much of a decision tree. Each program has different conditional statements that are similar but not exactly the same, to deal with a decision that is either this or that:

if-else statements:
The following examples are equivalent and look almost the same, but not quite:

JavaScript Example Code:
var name = "Jim";
if (name == "Jim")
{
     alert("Your name is Jim.");
}
else {
     alert("You are not Jim.");
}
Python Example Code:
name = "Jim"
if (name == "Jim"):
     print ("Your name is Jim")
else:
     print ("Your name is not Jim")
Ruby Example Code:
name = "Jim"
if name == "Jim"
     print "Your name is Jim"
else
     print "Your name is not Jim"
end
That takes care of "the fork in the road", so to speak, but what if there's more than one decision to make? It can't be just "Jim" or "no Jim" all the time. What about Jim, Bill, and Heather, for example?

else-if statements:
Depending on the program, this statement is called else-if, or elif, or elsif, but you get the idea.

JavaScript Code Example:
if (name == "Jim")
{
     alert ("Good Morning, Jim.");
}
else if (name == "Bill");
{
     alert ("Good Morning, Bill.");
}
else if (name == "Heather");
{
     alert ("Good Morning, Heather.");
}
else
{
     alert ("You're not on the list.");
}
Python Example Code:

if (name == "Jim"):
     print ("Good Morning, Jim.")
elif (name == "Bill"):
     print ("Good Morning, Bill.")
elif (name == "Heather"):
     print ("Good Morning, Heather.")
else:
     print ("You're not on the list.")
Ruby Example Code:
if name == "Jim"
     return ("Your name is Jim.")
elsif name == "Bill
     return ("Your name is Bill.")
elsif name == "Heather"
     return ("Your name is Heather.")
else
     return ("You're not on the list.")
end
print name
As you can see, there really isn't much difference between now each language expresses conditional statements. The details are quite minor and I hope this all illustrates the common factors in such statements, which is the important piece to learn in this lesson.


Time limitations are forcing me to make Part II shorter than I originally intended, but at least I've got it up and on the blog. Pick through everything and see if I left any holes. If so, let me know. If not, then all is good, at least for Part II. See you next time for Part III: Loops.


Share/Bookmark

Wednesday, September 9, 2009

Learning PHP, MySQL, and JavaScript: A Step-by-Step Guide to Creating Dynamic Websites

Author: Robin Nixon
Format: Paperback, 526 pages
Publisher: O'Reilly Media, Inc.; 1st edition (July 22, 2009)
ISBN-10: 0596157134
ISBN-13: 978-0596157135

Unless you've been hiding in a cave for the past ten years or so, you know that it takes more than a bit of HTML slight-of-hand to make a modern, dynamic website. The (so-called) Web 2.0 is constructed of a mix of technologies, creatively applied to allow the interactivity we have become accustomed to when surfing the web. Just looking at the front and back covers of Robin Nixon's book, he (and O'Reilly) promises to teach the reader all of the technologies (though I see no mention of CSS) required to bring your Web 2.0 creation to life, and send it out on the Internet. The best bit of news is that, according to the back cover blurb, "No previous programming experience is required." Really? We'll see.

Frankly, programming isn't all that easy. If you've never programmed before, you learn your first programming language and all of the principles of programming in general, all at the same time. This can be an enormous chore, compared to knowing basic programming skills and adding another language to your bag of tricks. Certainly learning PHP, JavaScript, and MySQL seems a daunting task for the coding newbie. There are entire books written on each of these technologies, just for the beginner. It seems that Nixon has quite a job cut out for him.

I checked, and the Preface does say in the Audience section, that this book is suitable, not only for webmasters and graphic designers, but also for high school and college students, graduates, and the "self-taught" (the latter would be me, so I guess this is a good fit). The next section does announce the Assumptions This Book Makes, so it's not all gravy. HTML is the only concrete assumption (and again, I'm surprised no mention of CSS is included, since it is largely required for web page formatting). While prior exposure to PHP, MySQL, and JavaScript isn't required per se, such exposure will allow the reader to progress through the book at a faster pace. That makes sense, but I'll hold the author and publisher accountable to their stated intent, that I (or anyone) won't need such exposure to benefit from this book.

One thing I liked (and I'm still not out of the Preface), is that the book references other books the reader should move on to, once they've completed Nixon's work. Dynamic HTML: The Definitive Reference (also by O'Reilly) is included which is another surprise, since the reader is assumed to at least be familiar with basic HTML, if not a "master" in this area. The other books are all O'Reilly publications (what else?), targeting PHP, MySQL, and JavaScript. No surprises here.

The first chapter is all high level concept regarding the nature of HTTP, and the various technologies headlining the book. Apache in specific, and open source in general also are included. Nixon seems to be setting the stage here for further learning to take place. The chapter is short, and ends modestly with a few simple questions for chapter review. The answers to these, and all the questions posed in subsequent chapters, can be found in Appendix A. This is a "good/bad" thing. It's good in that, if the reader gets stuck, he or she can pop back to the appendix, or just check to see if the answers they gave are correct. It's a "bad" thing in that, sometimes people get stuck quickly and, rather than trying to figure out the solution, will cut to the chase and head for the answer section. Generating effort to find an answer is how most people, especially me, learn. That said, it's better to provide confirmation, rather than have the student never know for sure.

To set up a website, you need a server. In this case, the server needs to be capable of providing basic web services, database services, and PHP. Enter LAMP (or WAMP if you're a Windows person). Setting up a basic LAMP (Linux, Apache, MySQL, PHP) or XAMPP server is ridiculously easy, as the apachefriends.org site illustrates. The book uses other resources, such as easyphp.org, if you need to set up WAMP on Windows. MAMP is also available for Mac OS X people, so no one is left out of the loop based on OS of choice. So far, there's a significant amount of hand holding going on. What happens when the reader has to get their hands dirty with an actual programming language, such as PHP?

Hello world. Yes, this time-honored method of beginning to teach a programming language is introduced on page 34. The book's companion website hosts all the sample code used in the book. Just go to lpmj.net and then click on "Examples" to download the zip file. The site's table of contents also lets you select a chapter and section, to view sample code, if you don't want to refer to the downloaded files. Nixon faces the challenge of teaching both basic programming skills and PHP reasonably well. A programmer at my "day job" recently created the analogy of an array being like a series of shoe boxes. Page 40 compares arrays to a series of matchboxes, which is more or less the same thing. I mention this to draw out the teaching style used here. Learning a language is one thing, but you won't learn it well unless you understand why things work as they do. Besides, the goal isn't just to learn programming, but to learn it in the service of creating a "dynamic website".

There are five chapters that immerse the reader in PHP, before switching gears and moving to MySQL. Again, LAMP/WAMP/MAMP/XAMPP provides a handy "safety net" for the reader in managing everything and keeping it all in one container, but there's still a lot to learn. The last PHP chapter is a nice set up for the introductory MySQL chapter. Just when you think you're making some progress with PHP, you're sent back to "kindergarten" and the basics of relational databases (and as an aside, if the idea of databases is just too intimidating for you, check out The Manga Guide to Databases, which I also reviewed).

The next MySQL chapter puts what you've learned about PHP together with MySQL, so don't think you can forget chapters 3 through 7 at this point. It's not a straight shot from MySQL to JavaScript, which actually makes sense. Topics such as creating forms. and PHP templates are launched at you before you even breathe the word "JavaScript". After successfully (hopefully) tackling PHP, JavaScript becomes the second programming language the reader learns. PHP is a server-side language, and JavaScript works on the client-side, but the basic principles learned in the first, will handily serve the reader in learning the second. Variables and Arrays are still Variables and Arrays conceptually. The difference then becomes one of how each is expressed and managed in different languages.

JavaScript and PHP collide in Chapter 17 and Ajax enters one chapter later. Chapter 20 declares, "Bringing It All Together", but while reading this review may not have taken you much time, getting to this point in Nixon's book could take weeks or even months. This all depends on your dedication, available time, and how quickly you've managed to learn everything in the previous chapters. There will probably be some readers who become discouraged long before this point in the book, which is why regular use and persistence is required here.

Assuming you make it all the way through, and actually learn everything that's being taught, you'll be able to put together a relatively modest, interactive website, just using this book. No, you're not an expert, but you should be feeling a sense of accomplishment by now. The "Robin's Nest" website example used looks pretty vanilla flavored. I guess you'll still need to go out and pick up CSS to add some spice.

In addition to the end of chapter questions being answered in Appendix A, Appendix B lists various online resources to consult, but that's all...it's just a set of lists of URL, but fun to explore. Appendix C and D cover MySQL FULLTEXT Stopwords and MySQL Functions respectively. My guess is that, you'll probably have started consulting external resources on dynamic website construction long before you finished this book which again, makes sense, though the book is quite self contained.

O'Reilly books tend to cater to readers who are already at least somewhat experienced, so it was nice to read and review a book that truly caters to the beginner. I would have preferred more end-of-chapter material, to test the reader's newly acquired skill sets, and I definitely would have included CSS as an assumed technology. It's not necessary for Nixon to teach CSS in any form, but style sheets are just too tightly integrated into, not only web site formatting, but in many cases, functionality, to just be ignored. That said, Learning PHP, MySQL, and JavaScript is a worthy effort on both Nixon's and O'Reilly's part, to introduce the programming and database neophyte into the world of dynamic website design.

Share/Bookmark

Monday, June 8, 2009

Front End Drupal: Designing, Theming, Scripting

Authors: Konstantin Käfer and Emma Hogbin Format: Paperback, 456 pages Publisher: Prentice Hall PTR; 1st edition (April 15, 2009) ISBN-10: 0137136692 ISBN-13: 978-0137136698 The Käfer and Hogbin book isn't just a "how to use Drupal" book. There are a number of books that introduce Drupal in general (I put in the link just in case you need to know what Drupal is), including Using Drupal (O'Reilly) which I previously reviewed. According to this book's back cover blurb, "Drupal is now the world's number one content management system...As Web Designers and developers adopt Drupal, they need ways to quickly customize the visuals and interactivity with their sites." Is Front End Drupal then a book with just a focus on designing and managing themes, or is there more "under the hood"? Let's find out. As always, my first question for a book is "who is it written for?" The back cover invokes "web designers and developers", which presupposes a certain skill set. The authors have backgrounds in both web development and Drupal, so that should also be a clue. That said, I didn't find a section in the front matter of the book saying "this is the book's audience" or similar text. The context of the book will have to do, but who the book is created for should become fairly obvious early on. The first page of the Forward states the basic problem and thus, the reason this book was written. Apparently, Drupal sites "out-of-the-box" are "ugly". Further, Dries Buytaert (Drupal founder and project lead) says "...creating a Drupal theme isn't always easy. It's a crosscutting experience that requires a lot of diverse skills and utilizes expertise in XHTML, CSS, JavaScript, and PHP..." That should be enough to define the target reader of this book, at least as far as what you have to know to utilize this text. Chapter 10 is an introduction to jQuery, further narrowing the focus, at least as far as JavaScript libraries are concerned. Chapter 1 starts out with a lesson on how basic web design integrates with Drupal. No, it's not an XHTML/CSS primer. You are supposed to know that stuff already to be able to utilize this book, but the authors do suggest here that you access those skills when mapping out the design of your future Drupal site. They do include resources such as Zen Garden and W3Schools.com's CSS Tutorial for those who might need to brush up in that area, so it's not like you have to be a total guru. I found this interesting because, as I moved through the book, I found that being a guru helps a lot, but more on that in a minute. Theming tools and strategies are added onto this "gentle introduction" and the more formal introduction to Drupal begins, including JavaScript, PHP, and the Drupal API. The mechanics of creating a Drupal theme are presented as early as Chapter 3, including more online tutorials and code examples in the book. This is where your coding experience starts to be needed. A basic understanding of at least XHTML, CSS, and PHP is required from here on in. I say "at least", because the book will not hold your hand as far as learning these technologies is concerned and even then, I don't think just "basic" skills are quite sufficient. The way the topics are presented doesn't seem to be quite "even" and I really think a lot of prior web design/development, and even some prior Drupal experience helps in having a good reader experience. In fact, if this book was my introduction to Drupal and I had no other experience with this platform or with other Drupal books, (even if I was well versed in the underlying technologies), I can see myself getting lost somewhere in the first third of this text's pages. If I was expecting a "total newbie's" book, I'd probably write a review slamming the authors for getting me in too far over my head. Do not, repeat, do not use this book if you have no experience with Drupal at all. Even more, do not use this book if you have little or no experience in web development. This book is best used by people who are (despite the resources presented in Chapter 1) well versed in how to design websites. If you work in a content management firm, you are probably ideally positioned to use Front End Drupal. The book's Appendix describes how to install Drupal, if you don't know, briefly discusses LAMP/XAMPP, and provides equal time for Windows, Linux, and Mac OS X as OS platforms. A "value added" piece is the book's support website which has the sample code included in the book available for download. There's also an errata page for the first printing of this book, so you can check if any issues or errors you come across have already been dealt with. Contact the authors if you come across something new. I'd suggest downloading and configuring Drupal up front and learning basic Drupal from a book like O'Reilly's Using Drupal before digging into Käfer and Hogbin's Front End Drupal. Save yourself the aggravation (or the temptation of writing a "negative" review on this book) of trying to follow along with this book if you don't have a Drupal background already. Those of you who do know Drupal and know web development, have fun.

Monday, April 20, 2009

Book Review: JavaScript for Programmers

Authors: Paul J Deitel and Harvey M Deitel Format: Paperback, 448 pages Publisher: Prentice Hall PTR; 1st edition (March 26, 2009) ISBN-10: 0137001312 ISBN-13: 978-0137001316 When I saw the title, I assumed that this was a somewhat advanced book and not for the reader who was learning JavaScript for the first time. I work for a company that develops web applications, and they make extensive use of JavaScript. Each of the developers is well versed in JavaScript and other web programming languages, and I thought this was a JavaScript book for the experienced programmer. With that assumption in place, I was surprised to see a comment on the back of the book state "One of the best introductions to JavaScript" (from a pre-publication review by Raymond Wisman, Indiana University Southeast). An "introduction" to JavaScript? Even a casual scanning of the back cover reveals that the book is supposed present a vast cornucopia of JavaScript related topics. Deitel and Deitel have written quite a number of programming books, so I was interested to see if this indeed was a book where one could learn JavaScript from scratch. The Deitels have written a significant number of "How to Program" books for languages including C, C++, Java, and Visual Basic, but no "How to" book appears on their website (until this one apparently) for JavaScript. Why not "JavaScript How to Program" instead of "JavaScript for Programmers" if this is a beginner's book? Despite the title, the book is structured for the "extreme" beginner, starting with the history of the Internet, the World Wide Consortium (W3C), Web 2.0 and so on. Going through the Preface material, I found a lot of information, especially about Deitel and Deitel, as well as Deitel and Associates, Inc. (apparently, they like to promote themselves a lot, but after all, business is business), but nothing that specifically stated the identity of the target audience. Since the book is structured to present XHTML and CSS first, I could only imagine that the book would be suitable for someone who didn't know those technologies. The majority of the book (eight chapters) is devoted to JavaScript (as it should), while the two ending chapters contain content on XML, RSS, and Ajax. That's quite an ambitious mouthful to teach the newcomer to web development. Anxious to try out the book, I dutifully followed the Before You Begin instructions and attempted to download the source code from the listed link: www.deitel.com/books/jsfp/. That's when I got a big disappointment in the form of a "The page cannot be found" error. I rechecked the URL and I had typed it as printed in the book. I went to the Deitel site to see if I could just navigate to the source code, but not only was the code not present, there was no mention of the book at all. I went to the publisher's site to see if perhaps the source code was there. I did find it and I could download the source code for chapters 2 through 13, I'd need to download the files for each chapter as individual zip files. I looked for an errata page at InformIT to see if a change had been made regarding the stated location of the source code, but there was none. The errata page at the Deitel site didn't mention the book at all. I don't mind doing my research when I'm learning something, but I wouldn't expect the reader to have to work this hard when they're not even in Chapter 1 yet. I skipped the Chapter 1 history lesson and opened the book to Chapter 2, since I'd downloaded the sample code for the chapter. The zip file contained a number of rather simple HTML files. Nothing to write home about, but I guess you'd expect that if you were starting from the beginning. Actually, Chapter 2 is a crash course on HTML, including how to create lists, tables, forms, and links. The information was compressed, but entire books are written on basic HTML, and I wondered if the complete beginner was supposed to "get it" in one brief chapter. The very last entry in the chapter though, was a link to a page on the deitel.com site containing all kinds of external links to information and tutorials on HTML. Apparently, the Deitel site is supposed to provide serious support to this book (lack of code samples or even a mention that the book exists aside). Chapter 3 was the other bookend to Chapter 2 and offered up a quick and intense course in CSS to the reader, with another link at the end to a web page packed with external links to all things CSS, including books on CSS by other publishers such as O'Reilly. I was beginning to see that, depending on the reader's level of experience and how quickly they learned, it might take awhile to work through this book. If I knew nothing about HTML and CSS and I only had 2 chapters in a book to teach me those languages, I might end up spending some time on the recommended links pages on the Deitel site, doing a bit of self study before tackling the JavaScript section. I rather expected the JavaScript chapters to be more self contained than the others, since its the main focus of the book. While that's true, I did find that the end of each JavaScript chapter did include a link to a JavaScript resources page on the Deitel site, so the book is written with the general philosophy of the web containing everything the book can't. As I continued to move through the book, I was taken on a path using more "baby steps" as bit by bit, the JavaScript tutorial began to unfold (if you'll pardon the mixed metaphor). I will admit, I didn't download each of the chapter's code examples (I may later and, if what I find is significant, I'll publish an update to this review), but what I saw did seem to work. That's important, since one of the common complaints I hear from programmers, is that sample code often doesn't work as advertised, as if the code were never tested and debugged prior to the book being published. The good side of this book is that it is written to take the very beginner from basic XHTML and CSS and gently help them through the process of learning how to program in JavaScript. The bad side is that the reader has to work up front to even find the sample code, and it's as if Deitel and Deitel didn't think enough of their latest work to even mention it on their site. For a company that creates training material for a living, that's not a very good way to back up their book. Good thing the support pages were accessible with all of their external links to a wider collection of tutorial material. They say a first impression is a lasting impression. If that's so, no matter how good the later parts of this book are written, getting past the first bits didn't help my first time experience with a Deitel book.

Wednesday, January 28, 2009

Review: Creating a Web Site: The Missing Manual

Author: Matthew MacDonald Format: Paperback, 606 pages Publisher: Pogue Press; 2nd edition (January 7, 2009) ISBN-10: 0596520972 ISBN-13: 978-0596520977 Matthew MacDonald is something of an "in-house" author for the Missing Manual series. He's "penned" (and I use the term loosely in this day of the word processor) Access 2007: The Missing Manual, Excel 2007: The Missing Manual and, of all titles, Your Brain: The Missing Manual (and since I've reviewed all three of these books, I can tell you that he had a little expert help with the last one, especially). He's also written quite extensively for Apress and seems to be well versed on a number of topics. That's why I thought Creating a Web Site might be a little "light" for him. I don't belittle the creativity and technical expertise involved in developing a website (and having created a few in my day, I know whereof I speak), but HTML, CSS, and a smattering of JavaScript isn't perhaps as challenging as writing about how your brain works. On the other hand, there's really so many details to web design that, instead of being to "light", MacDonald may have bitten off more than he could chew by trying to cram "everything" into a single book. Of course, I'm speaking from the point of view of not having cracked open the cover yet. Let's see what this book has under the hood (and I'm really mixing my metaphors in this paragraph). Actually, it's "the hood" I noticed first, or rather the red "ribbon" on the cover saying, "Fully-Revised 2nd Edition". I'm used to reviewing later editions of earlier classics (the first edition of this book reviewed quite well), but "fully-revised" caught my attention. When writing a subsequent edition, often much of the original content doesn't need to be changed; just the bits of the technology that have been updated in the few years between books. Fully-Revised implies MacDonald overhauled the entire thing. It would be almost like writing a new book. No clues were to be had on the back cover, so under the hood I went. I was also disappointed that the Introduction held nothing that said "What's New in this Book". I'd be willing to bet that Part Five: Blogs is probably one of the sections that was added. Of course, if MacDonald really did completely redo the book from scratch, there will be no new "parts" of the book; the entire structure and content will be new. Sadly, I didn't find any direct indication of this in the opening parts of the book, either. What I did find, at least at the beginning, was a book written for the beginner. Fortunately, there's no "history lesson" on the development of "the Internet" or web browser development (I don't think I could have forced myself to take another stroll into the early years of Netscape). Chapter 1 does lightly gloss over about a page worth of Internet history, the major browsers (including Google Chrome; newbie on the block) and various conceptual items. Chapter 2 offers the reader the opportunity to create their first webpage and so on. Definitely starting at ground zero, which isn't a bad thing. If you wanted to design your own wee site, you'd want a book to hold your hand and guide you along the front end of the trail. There's enough in the second chapter to get the reader to create a single HTML page and display it in a browser. Progressing through the book is like walking up a set of stairs. This is good for a linear thinker like me. Since this is a book about building websites, it presents more than just HTML and such. Chapter 3 talks about how to choose a webhost; necessary if you expect people to be able to access your site via the web. Chapter 4 introduces the reader to web editors including Adobe Dreamweaver (of course) and Microsoft Expression Web, but also lesser known editors such as open source Nvu and w3.org's Amaya. Since this is a general text about building websites, the material here goes into virtually no depth at all and we know that entire racks of books have been dedicated to Dreamweaver. Don't expect to become an expert on any of the editors from what this text gives you. Part Two takes the reader back into the basics of building and developing web pages, going into more detail about XHTML and CSS, then building on those concepts and practices. This part of the book is what you'd typically expect and MacDonald delivers. In fact, at roughly 200 pages, you could consider this section to be a small book all it's own, teaching the language side of website construction. Remember though, a generalist book has to cover a lot of territory. Part Three is the "marketing" section. Once you've built a site, it doesn't do much good if people don't visit. There's even some material on how to monetize your site using tools such as Google AdSense, Amazon Associates and so on. I thought we were probably through with the "technical" side of website development, when MacDonald took me back into the realm with what he calls "Web Site Frills". These days, I don't consider JavaScript a "frill" but rather a standard "screwdriver" or "hammer" in the web designer's toolbox. Of course, limited to one chapter, there's not a huge amount of information to be gleaned (and The Missing Manual series has an entire book dedicated to JavaScript written by David Sawyer McFarland, but I digress). Of course, how many amateur web designers just "Google" for the bit of JavaScript they need and paste the ready-made code into their webpages? The part of the book on Blogs seemed a bit of a departure from everything that came before, mainly because a blog isn't a website as such. People (myself included) often have a website and blog, since they fulfill different functions on the web. Even MacDonald introduces this section by telling the reader that he's moving away from the web site building agenda. He makes heavy use of Google's Blogger which is building a blog with assistance. I will admit that the skills the reader should have learned up to this point will let them customize the style sheets underlying the standard templates, so they can create their own look and feel (functionality is still largely controlled by the available widgets). I found the "hazards" of blogging box interesting as the author addresses some of the social pitfalls of putting what amounts to a personal journal on the web for all to see. If you've never made a blog with Blogger before and think you might be intimidated by the process, this section contains a nice tutorial for the you. "Marketing" your blog is restricted to another box at the end of the section, but it might be helpful for the uninitiated. I was pleased to see that the appendixes included the expected XHTML reference and a "useful web sites" list, but I'm not sure what to think of the book overall. It's been awhile since I've needed a basic primer on building a web site, and I'm torn between thinking the book was too short and too long. It really tried to cover all the basics and then some, and yes, the reader will be able to design, develop, and publish a site to the web if they follow what this book says. On the other hand, it's a mile wide and an inch deep. You can't cover everything you'd really need to know to design a really good site in a single book, even if it's over 600 pages long. I think the book might better have served its audience, even if it reduced itself in size, by confining itself to teaching web design and publishing basics. I'm not even sure I'd have thrown JavaScript into the mix but instead, would have pumped in more HTML and CSS. I'm torn because, as I previously said, you hardly find a site on the Internet anymore that doesn't have some JavaScript. So where do you draw the line as far as what to put in this book and what to leave out? What I really wanted to see was references to the other Missing Manuals that more exclusively cover the technologies barely touched upon in this text. The Missing Manual series has books on just about everything that addresses CSS, JavaScript, Dreamweaver, and such and in depth. Using this book as a spring board into those other books might have been the way to go. Don't get me wrong. The book will teach you want you need to know to create a web site, and MacDonald is honest, albeit in the Blog part of the book, that what the book doesn't address is how to maintain a website. If you do what the book says, you'll have a website on the Internet that will function at least adequately. If that's the goal of the book and the reader, then you're all set. It's just that so much more can be done and many of the book's chapters could have ended with something like "Please see CSS: The Missing Manual to get more out of your style sheets". As a parting thought, I received Head First Web Design from O'Reilly the same day as I did the Missing Manual book, so it'll be interesting to me (and hopefully to you) to compare the two books when I write the "Head First" review. Which book is better for the beginning web designer or, does each book point to a different audience? We'll find out soon.