3

The OO Page

 2 years ago
source link: https://soffes.blog/the-oo-page
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

The OO Page

Posted on September 4, 2007

I love objects. Programming in Cocoa has really made me understand the power of OO (object oriented) programming. I‘ll take a minute to explain objects and MVC for a minute. (If you are familiar with objects, move to the next paragraph.) An object is a variable that has multiple variables and functions (called methods when inside an object) inside it and is an instance of a class. A class is some code that tell the object what it can do. One very popular approach to using objects (or just programming in general) is the MVC method (model, view, controller). Each of the elements of a MVC are usually objects too.

In my simple web site, I use CodeIgniter, which is an open-source PHP framework that makes OO PHP easier and quicker, to run things. I have created several libraries (or classes) to take more work from me and moving it to my libraries. The ones I use the most are Page, Sidebar, and Widget. For the first time in PHP, I have used multiple instances of the same class on the same page. In CodeIgniter, this isn't done that often because you rarely have to, but I decided it would be fun, so I am.

My Page object is my page. It creates my <head> tag, page template, and assembles the rest of my views. One of it‘s views is the sidebar of course. The sidebar is also an object that contains an array (think of it as a list if you don‘ know what it is) of widgets which are also objects. After adding all of my widgets to my sidebar, the page objects asks for the final HTML version of it when it‘s ready to display the page. Inside each sidebar widget, there are several methods for manipulating how it looks and acts too.

This is quite complex, so instead of just talking about all of my objects, methods, and variables, heres a diagram:

I love this way of programming because it keeps the code in the controllers and view very short and tidy. If you want to know more or if you want to get your hands on the source code, email me on the about page.

Coming Soon

Posted on September 3, 2007

samsoffes.com is gone right now. It will be back later. I‘m really excited about what this will be. I plan for pics from my everyday use of computers and little things that I run into that make me laugh or are entertaining. Most of my musing have been in the form of emails to my friend in the last year or two. Putting this site back saves them lots of email, give me something to do, and will give you something pretty to look at.

I also plan for a portfolio of all my work. From Cocoa, PHP, MySQL, XHTML, CSS, Javascript, AJAX, Quartz Composer, music, Linux experiments, and other random stuff, I got a lot to put there. I‘m real excited to get all of this up and looking really pretty.

The reason for the delay in a real site is that I am real busy! Between work, having a social life, all my random projects, my two LLCs, and freelance web stuff, when do I have time to make myself a site? It‘s coming in all of it‘s XHTML, CSS and AJAX goodness. I promise.

Continue reading →

© 2006-2022 Sam Soffes


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK