"Object Orientated Web Development" = Oxymoron?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
EvanClark
Forum Newbie
Posts: 9
Joined: Thu Aug 22, 2002 1:36 am
Contact:

"Object Orientated Web Development" = Oxymoron?

Post by EvanClark »

Has anyone here ever developed a Web-based application in PHP using strict Object-Orientated design?

I just don't see the need.

When programming in Java, I couldnt live without OO. OO PHP, on the other hand, doesn't strike me as a development language which you'd need classes.

If anyone disagrees, please enlighten me. Thanks. :)
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Re: "Object Orientated Web Development" = Oxymoron

Post by mikeq »

EvanClark wrote: When programming in Java, I couldnt live without OO.
When programming in Java you don't have a choice.

I think it is a case of each to their own. I used OO in a project where there was a few developers on it, it was better to create classes to do certain things and the other developers don't have to worry about the implementation of how the classes do things, they just need to know what objects to create and methods to call.

The other developers were also less experienced and to have them write the same code to do things which had already been written would have increased the development time and potentially bugs.

I really do think it is a case of do it any way you want, if you want to use OO do so, if not then don't.

PHP gives you a choice about wether you use OO (by the way Delphi does this also)
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

At work, we use classes, along with procedural. In my line of work, being able to get a complete application out the door in under a week is almost a must.

I built an emailing system, that can send to emails to a list of people in HTML or Text. It stores email lists in a special formt that any of our reporting tools can send to and create. It can also take information from this list, and use it in the email. This means we can create custimized emails. To note, the information that can be customized with is whatever the users wants, it's practically unlimited. It also has an built in mini WebBased HTML Editor (for those who don't know the basics of HTML), has a test send feature, and can handle sending emails into the thousands.

It was developed in 3 days, with a 4th for testing, and is now used successfully.

It's procedural, and relatively simple in design. To have been forced to write objects and use objects extensively would have forced me to design my object structure, as well as design my program. To this end, being given a choice made the difference.

Now, we do also use classes in many areas. This does indeed help use out. I am working on a class right now to replicate views in MySQL, so we can actually create these views on the fly, and then use them later without any additional work done on the programmers part. All they do is perform an SQL query, and the class will return a result set. Everything else is done internally to manage the views.

So technically speaking, I like being able to choose my programming methodology. Saying OOP is the only way to program is like saying Windows is the only OS to use. No, their are other methods out there, each with their own merits and flaws. To have a language force upon you one methodology doesn't sit well with me.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

I have been working on a web application for the past two years in my spare time. Its has already passed 10kLoC. The first version was straight procedural and I lost the ability to keep it organized and understandable. I re-designed it, and rewrote most of it using an OOP based implementation. Its now more fully featured and easier to improve. Lately I've been going through a tidying up a few places and the code is getting much more elegant and even easier to maintain.

So for me it worked. Whether it will work for you will depend on a lot of factors. But OOP and PHP can work well together.
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

Jason, do you use the mail() function for that email program?

Also I've seen people say they take a performance "hit" with OOP in php, is that even noticable to an end user?
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Yup, I use the mail() function. And up, I know it wasn't ever meant to do mass emails.

However, I have it setup to run through 20 emails at a time. So it's a slow process, but it makes the job very simple.

As far as the performance hit is concerned, yes and no. If you are running a time critical application, objects aren't going to go over very well. For example, our games are procedural.

However, our backend applications use quite a number of objects without a problem.
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

not really, but when 100 people access your server at once, the extra 100kb of data you stored in RAM because of a bad query - becomes 10,000kb...and it adds up to everything... your server bogs down and you look for ways to keep things as lite as possible
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

Or you convince people to buy a better server, turning the old production machine into your own personal development playground :D

My new server hasn't used its swap space yet, and steady steady operation has all the databases loaded into RAM with more than half the RAM to spare :D
Post Reply