hobeau Posted January 23, 2009 Share Posted January 23, 2009 Man, Wrong, wrong, wrong! Programming in an OOP Language does NOT equal programming in an OOP Way! OOP is a methodology which requires alot of practice and thought to do correctly and efficiently. Unfortunately I have been misunderstood. I do not mean that programming in an OOP language equals programming in an OOP way. I mean that to program at all with a language like C# or Java, you absolutely WILL use objects even if you do not write a class. For instance, if you want to connect to a database you will be using the System.Data namespace. Then you will be using the data classes to access the database and you must use the properties and methods of this class. In php, you have an option to do functions or object oriented. For instance, http://us.php.net/manual/en/mysqli.query.php you will see that there are 2 methods to connect to the database using the mysqli extensions. The first is a procedural method, the second is an object oriented method. C# and Java does not have this. This is what I meant. Sorry for the confusion. Quote Link to comment https://forums.phpfreaks.com/topic/142038-good-uses-of-oop/page/2/#findComment-744504 Share on other sites More sharing options...
Maq Posted January 23, 2009 Share Posted January 23, 2009 I mean that to program at all with a language like C# or Java, you absolutely WILL use objects even if you do not write a class Of course you do. Even string in Java is an object itself... Quote Link to comment https://forums.phpfreaks.com/topic/142038-good-uses-of-oop/page/2/#findComment-744532 Share on other sites More sharing options...
phparray Posted January 23, 2009 Share Posted January 23, 2009 My preference is name.cls.php if you have a classes folder. For my own stuff I create a folder called classes and name each class the same as the file name it communicates with on the view layer of the site. When working on a project it is really easy to know right away where to go when a function needs to be modified. For ajax sites I create a folder called output and again put files with the same name as those in the view. My file structure would look pretty close to this. index.php includes/classes/index.php includes/output/index.php forum.php includes/classes/forum.php includes/output/forum.php administrator.php includes/classes/administrator.php includes/output/administrator.php I would not call this common practice or a standard of any kind but it is what I do to keep everything straight and has proved to be a very scalable method. Quote Link to comment https://forums.phpfreaks.com/topic/142038-good-uses-of-oop/page/2/#findComment-744639 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.