|
Leroy Member Level: 19 Posts: 31/60 EXP: 30456 For next: 5321 Since: 07-18-10 Since last post: 11.6 years Last activity: 11.0 years |
|
Originally posted by TerraI didn't want to have anything to do with 'hip' and 'trendy' Object Oriented Programming years ago, in my board scripting era, either. Nowadays I have a pretty much identical set of scalable classes I can use without adapting changes in every new project. Call it a matter of taste, but I'd rather work with this:
... than this:
The first, object oriented method allows IDEs with auto-completion (such as Intellisense for Visual Studio) to create a list with all properties/fields/methods your object contains. With just a few keystrokes and small amounts of code, you can make very effective and functional scripts and even programs. And best of all, you aren't required to know everything about your database (IE column names and the like) every time you want to work with data, because your business logic class takes care of that. Plus, it's generally bad practice to put SQL queries in your most front presentation files. That's very prone to errors, not very scalable and crops your files with logic that belongs elsewhere. It's better to make a so called 'Data Access Layer' where all the interaction between application and database takes place. That way it's easier to maintain and secure, not to mention make it easier to port (parts of) your application. I've had projects where the application had to be compatible with MySQL, MS SQL Server and Paradox. Good luck achieving that when you put all your loose, database platform specific queries in your presentation files.
Originally posted by OoBurnsQFT. I'm currently rewriting the core code base for the PHP version of my CMS, and I'm once again made clear how annoying PHP can be by not properly supporting/implementing basic stuff such as enumerations, strong typing, method overloading, etcetera. Even the 'type hinting' alternative PHP offers because of the lack of strong typing is extremely limited, and doesn't even work on native types such as string and int. ![]() |











Even in PHP, it's possible to make a class with fields, properties and methods that represent a logical object of your application. It's quite a chore as opposed to how easy it is in languages such as C#, but still, possible.


![this is about the only use for Twitter [loading witty comment...]](http://twitstamp.com/custom-2013.png)
