- Killer Javascript for web designers

JavaScript Programming - Part 2

Part 1 | Part 1a | Part 1b | Part 2 | Part 2a | Part 2b

Object Oriented Programming

This is only the 2nd installment of a series of articles designed to teach total beginners how to program, providing a foundation to learning many of today's most prominent languages that include JavaScript, PHP, Java, and several others.

The eventual goal is to teach you how to program using the DOM. I move fairly slowly in these articles, attempting to cover any stumbling blocks that may hinder people.

When learning something new, things may not be clear at first. You just need to push on because sooner than you think, things will 'snap' into place for you. Soon you will be wondering why you thought it was hard in the first place!

One of the reasons people find programming so challenging is that they do not get a good enough grasp of the basics. In my own process of learning to program (I have picked up 8 languages so far) I have always found that every time I got confused was because there was some basic concept I did not grasp. The solution is always to go back to the basics, because once you have them, everything else is easy!

Why did I mention all this?

I wanted to explain the reasoning behind my approach to teaching programming in these articles. The first two articles are theory-heavy and I take my time to slowly introduce these core concepts of programming. There are some actual programming examples but they are short. Once the basic concepts are understood, we will jump into practical usable programming examples, which by that time will be much easier for you than if I would have jumped in right away.

Our eventual goal: to use the DOM

The DOM (stands for: Document Object Model) is a framework that allows you to have total control over your web pages using JavaScript. What do I mean by 'total control'? I am talking about being able to add, remove, and edit text, images, and tables and any other element on the page on the fly.

Easily build dynamic menus, change the font size of a paragraph on your page when someone clicks a link or image, etc. I won't go on, but you can do all this and much more and it will work with all the modern browsers since the DOM is a standard that the browsers adhere to well.

Introduction to Object Oriented Programming

Object-oriented programming is the 'in way' to write software and is the foundation of many languages including JavaScript. To truly understand how to use JavaScript you must understand some of the basic concepts of object-oriented programming.

I will only be teaching you what you need to work with JavaScript so don't worry! But what you will learn about object-oriented programming is applicable to every object-oriented programming language out there, and that's a good thing.

OOP (OOP is short for: O bject O riented P rogramming) is a style of programming that is used in many of today's most prominent languages that include Java, PHP, C++, JavaScript, and several others. In a nutshell, OOP attempts to build programs by conceptually breaking them up into a series of individual objects (programmed objects) that interact with each other to create a program. In a sense, these objects are like mini-programs inside one big program.

Another way you can think of it is as a business (like Microsoft or McDonalds) where the business is the program and the objects are the people who work at this business and with each other to get the work done.

So for example, let's say at a McDonalds we have Wang, who works the cash, Tyrone, who makes the burgers, and John, who washes the floors. These three guys are in of themselves individual objects (a little insulting I know, but hey, this is just an example!) and each of these guys (objects) has its own function (things that he/it does) and together they make McDonalds work. Of course there are several others working at McDonalds, but the point is that all these individuals work together to do the job of running the restaurant.

So when you're Object Oriented Programming you are creating a bunch of individual objects that work together to make the program as a whole. I will get to an example in just a minute, but before I have two questions that must be answered:

NEXT: Other Ways of Programming »

© 1996 - 2024 – All rights reserved
  • Hosting and domain name support:
  • (480) 624-2500

PayPal Customer Support: 1-888-221-1161 has been a PayPal Verified Merchant since 2001. We also accept payment via check or money order.

Please send payment to: Inc. 4156 Dorchester #2 Westmount, Quebec Canada H3Z 1V1

The more you learn, the more you earn!

Web Design Tips & Tricks Newsletter:

My Web Design Tips & Tricks newsletter will let you know when any new articles, tutorials and videos on web design are released.