Learning What I Know

I recently received an e-mail from one of my subscribers that asked a question. The answer may be useful to some so I’m placing it here.

The original question

It seems so interesting developing websites application these days, thanks to the web 2.0 phenomena. I can’t call myself a web developer or anything near that, but I’m interested to learn these kind of [things].


Since you seem to be real world developer to me, I have a couple of questions to ask you. I’ve been messing around with XHTML, CSS, Javascript, PHP and MySQL [for] a couple of months now, and it frustrates me sometimes when I sort of forget things and [can]’t understand the flow of the design of what I’m trying to achieve. [..]

Based on your experience, do you do everything by your own, i mean there are the front end and the back end [things], do you do both?

Talking of object oriented programming (i guess that’s what prototype, script.aculo.us and ajax are really about), which OOP did u learn first? I [learned] simple Java before but does that come into play for web development as well? I mean, does it help if i go into detail learning Java?

Any other useful advice? I would appreciate your comments. Thank you.

My Reply

Web 2.0 phenomenon…Yeah, its good to stay on top of things like that :)

Development. XHTML, CSS, Javascript, PHP and MySQL…I do it all, however, I did not learn them all at once…but over a series of years. I think the key concept is to really try and keep your logic from your design – keep the MySQL/PHP side of things separate from the XHTML/CSS side of things ( e.g. Ajax, Templating, and the Separation of Layout and Logic). Javascript is a bit of a wildcard and bridges between both the presentation and logic.

You can do the above with and without Object Oriented Programming…although OOP is the preferred method. My first OOP language was Java. Next I branched out to Object Oriented PHP, and finally (last year) I learned Object Oriented Javascript.

All you really need is the OO concept in your head before you branch out and if you’ve used Java, you should be good to go. So to answer your question: “Does it help if you go into detail learning Java.” is this: It won’t hurt, but isn’t necessary to succeed in learning the above languages/tools. When using Object Orientation and switching languages, its all about learning the syntax and the gotchas associated with your chosen language.

The biggest chunks of advice I can give regarding your tools of choice are as follows:


  • keep it simple
  • use ids/classes rather than inline styles


  • live on php.net
  • learn through irritation with your own code…mine goes through constant revisions and optimizations
    – pick up a templating engine to help keep your layout and logic separate. I use XTemplates. I’m thinking about looking into SmartyTemplates….use whatever you wish…but templates save TONS of time.


  • know your data
  • know how to normalize your data
  • download open source applications and look at their database structure for a good idea of what their doing and go from there


Object Oriented JavaScript

javascript.gifJavascript has invaded my life. And I like it.

I have developed web applications for quite some time, writing Javascript off an often unnecessary tool that simply added frills. Over the course of this year – with the birth of the Ajax hype – I realize my error. I began inserting javascript all over hell’s half acre and raving about its sweetness. I’ve grown in a year.

As I develop more javascript-rich web applications for my amusement and my job, I am constantly seeking better ways to structure both data and code. It wasn’t until a month ago that I really began to dig into the Prototype and Script.aculo.us code (rather than simply using it) and began to grow aware of what was actually going on. Object Oriented Javascript.

I think it is important to note (so I don’t look like a complete nitwit) that I was aware that Javascript had this capability a couple of months back before I picked up and started using the afore mentioned Javascript libraries…I just had no drive to learn it and spot where it was being used. I have seen the light and it is good.

What are its benefits? Well, pretty much the same applies to Javascript that applies to any other programming language…OOP helps increase organization and reduce un-needed redundancy. And best of all? It helps prevent dual-declared functions and variables. That is the reason I chose to begin my quest for OO-JS familiarity.

I had gone hunting at a few other sites that claimed to be good references (obviously) of OO-JS, but they lacked the topic of inheritance, which is the real strength of any OOP Language. The most helpful article I found on the topic was at WebReference. They discuss the use of prototype (Not the Javascript Library). Here’s a quick excerpt, but I’d suggest you read the article for yourself!

Excerpt from WebReference

function Person() {
      this.name = "Rob Roberson";
      this.age = 31;

function Employee() {
      this.dept = "HR";
      this.manager = "John Johnson";

Employee.prototype = new Person();

var Ken = new Employee();

Ken is in the prototype chain of Employee, Person, and Object.

Check it out. Use it. You’ll like it. You’re applications will like it. Oh, and it may prove useful to check out some Javascript Coding Conventions.