- Killer Javascript for web designers

JavaScript Programming - Part 2a

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

Object Oriented Programming - continued

What are the other ways of programming?

The most prominent of the old styles of programming is procedural programming where software was designed based on processes. Ok, what does that mean?

It means that we just built programs in the order that they would do things. I don't want to go into details because it would only serve to confuse you, and today you want to learn OOP anyway! The bottom line is that this old style of programming got messy really fast and made for buggy software that was (and still is) hard to maintain.

Why would you program the OOP way?

You build software in the OOP style to save time and money; OOP based software is easier to build and easier to maintain. Humans like to put things in boxes or categories to help them organize them; OOP is essentially doing that.

Since this is a website about building websites, we are going to concentrate on programming in web pages using JavaScript.

A web page contains many objects that we can manipulate with JavaScript. One of the base objects is the window object. This object represents the browser window and as such provides ways to affect changes to a browser's window with JavaScript.

As I mentioned above, each of these objects (inside the program) have things that they do. These 'things' in programming-talk are called 'functions'. So basically a function is a thing that an object can do. Objects can potentially do many things; as such you will often find objects that have many functions.

Ok, I don't want to confuse you, but I need to clarify something: functions can also be called 'methods'. So why call them functions or methods when they have the same meaning, why not just call them functions? The reason is simple and rather nerdy: functions are just slightly different from methods! For our purposes, it is sufficient to say that when a function exists inside an object, it is called a method.

I will not go beyond that explanation because to know the ultra-nerd details will have no impact on your ability to program. The only reason I mention it is because when you start reading about JavaScript (and other OOP languages) you will see the word 'method' used a lot.

NEXT: An Example of a Built-in Method/Function »

© 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.