» Follow me on Twitter

While most will agree that PHP was not made to be an Object Oriented
Programming (OOP) Language, I’m still sure that there are still people
who, like me, believe that making use of PHP’s OOP features helps in
making cleaner and more reusable code. This is a starter article
which I hope will sparkle your imagination in using OOP in PHP.

What are the advantages of OOP? It makes your code cleaner and
more reusable - that is, you can use the same code for different
needs. The disadvantage, hmmm, sometimes, things get slower but
since PHP is a very fast language, this slowdown isn’t noticed at all.

OOP refers to things as objects. You can think of an object as
something that does a specific task. The cathode ray tube (CRT)
for example can be an object whose specific task is to display whatever
info is sent to it. And we see CRTs in TVs, X-Ray machines,
Ultrasound equipment, Computer monitors, etc. As you see, the
basic CRT hasn’t been modified too much to fit all it’s present day
uses. The same goes with Objects in Programming.

Let’s say we make a database object. The object’s purpose is to
store, retrieve, and display data. So we make something that does
just that. Or perhaps, we want a “Fruits” object whose purpose is
to store, retrieve, and display information about fruits.

These objects can then simply be grabbed the next time you need a
database object or a fruits object - no matter what application you are
making.

As I’ve said, this article is designed to tickle your
imagination. If you are interested in using OOP in PHP, then I
would say that the best place to go is PHP’s Manual itself. You can find this manual at: http://ph.php.net/manual/en/ref.classobj.php.

Enjoy!


» Follow me on Twitter


February 17, 2005 · Posted in Technology  
    

This may be obvious to most of you but still I am posting this here for
the sake of those who are like me - in search of a way to make startup
scripts in Debian.

The steps are not as easy as putting something in the “Startup” folder
in MS Windows but it’s also quite straightforward. Here’s how I
made my Debian startup scripts.
Login (or su) as root

  1. Go to the /etc/init.d folder (cd /etc/init.d)
  2. Write your script using a text editor
  3. Save your script in /etc/init.d
  4. Chmod your scripts to 755 (chmod 0755 scriptname)
  5. Type this -> update-rc.d scriptname defaults 20

That should do it!!!


February 9, 2005 · Posted in Technology  
    

Start a Franchising Business in the Philippines