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