Database Simplicity With Class

June 20, 2009

Database connectivity is one of the most important columns of a dynamic web. Besides being able to handle database queries with great flexibility, a website must provide the database with strong security. One solution is to write some thousands of lines codes and repeat the process for future projects OR use a single class to handle all the database functions for all your projects. Since I have one of the most powerful assets a good programmer must have that is, laziness, I would opt for the second option.

This article from provides a solid background for creating really flexible database classes that you can extend in the future. Also, they provide the article for three different languages (although you can adapt the idea for almost infinite number of languages). Enjoy!


Bunch of OOP Tutorials

June 13, 2009

Lesson: Object-Oriented Programming Concepts by Java

Basically it’s an introduction to Object-Oriented Programming written by Java experts. It’s a delight for programmers though since the tutorials mainly focus on the concept of the OO Programming rather than specific language syntax. Covers most of the topics in OOP including interfaces.

The Object Oriented Programming Web

I guess the site can describe itself better than I can:

The Object Oriented Programming Web publishes FREE programming and computer science tutorials, lecture notes, course slides and e-books. is a great resource for all programmers and computer science students, but it’s especially popular among those who are interested in C++, Java and Object Oriented Programming.

And damn, it has some of the nicest collections of algorithms, ranging from graph theory to Sorting and Searching algorithms

Object Oriented Programming in JavaScript by Mike Koss

I know it’s not a language independent tutorial but it is really, really an excellent tutorial. And besides, most of the web designers and programmers need to know JavaScript, the so-called “behavioural” language of the web. HIGHLY RECOMMENDED.

JavaScript Object-Oriented Programming

This is an article from SitePoint, so we can expect it to be really good. And it is. I am not much of a hard-core programmer but I can say that it’s a bit technical and as the name suggests, the article is language specific. But then again, everybody developing the web needs to know JavaScript by heart.

Object-Oriented Programming Concept

The tutorial is relatively short and can be skimmed pretty quickly (hey! that’s a plus point for us lazy coders). Mainly deals with the different types of relations between objects, their lifestyles and soap operas (okay, cancel the last one). Has some neat and easy-to-understand examples (cars and pizzas).

OOPS Concepts

This article from Exforsys Inc. is what you really want. It’s language independent and although sometimes it bends towards technical terms, it is relatively easy to understand. P.S. I first thought the site name was Exorcist (dyslexic? hmm).

What is Object Oriented Programming (OOP)? by Tony Marston

I don’t know about you but I really liked Tony’s series of articles about Object-Oriented Programming. It’s really meant to be Newbie-Object-Oriented-Programming (NOOP? I thought it would be noob). The author puts some really neat examples to make sure that everyone can understand the basic concept of Object-Oriented Programming.

Object Oriented Programming with PHP by Kevin Waterson

I know some guys get upset seeing the wealth of information scattered around the web but none of them giving suitable explanations. Well, Kevin is one of them then. This guy probably packed a whole book into one complete page explaining all the important concepts of OOP and also for us lucky web developers, he has written the article using PHP! He discusses advanced topics like Autoload, Overloading, and Class Constants. MUST READ.

OO PHP Part 1: OOP in Full Effect

And boy didn’t we see the effect in full or what? This article is a whopping huge post of detailed information about the PHP OOP features. Yes sirree it is not language dependent article but WTH (notice: I didn’t use WTF…I think I just did). So get some cups of 100% caffeinated coffee and start gaining vital knowledge about OOP.

PHP OOP Quick Review:

June 9, 2009
  • All properties must be declared and be preceded by one of the visibility keywords: public, protected, or private. (As with every rule, there is one exception when the visibility keyword is optional.)
  • Using a visibility keyword is optional when defining a method, but is recommended. If no keyword is used, the method is automatically treated as public.
  • “Method” is simply OOP (Object-Oriented Programming) terminology for a function inside a class. Use the function keyword when defining a method.
  • Use the new keyword to create an instance of a class (an object).
  • The $this variable inside a class refers to the current object.
  • Use the -> operator to access an object’s methods or properties (there is no space between – & >).
  • When accessing a property with the -> operator, omit the $ sign.
  • Attempting to access a protected or private property or method from an external script triggers a fatal error.
  • Use getter and setter methods to access protected and private properties and methods from an external script.

Source: “PHP Object-Oriented Solutions” by David Powers. A definite reference material to keep side by side with your famous “Gang of Four” book (What? You don’t own it?)

There’s only one thing that bothers me a bit. It says PHP triggers a fatal error when trying to access any private or protected properties from an external script. Does only trying to access them from an external script trigger error? Isn’t it that anything outside the class (in the same script) trying to access protected or private property triggers a fatal error?