dnenb Posted July 24, 2012 Posted July 24, 2012 How do you structure your code? Do you use any design patterns? Do you do OOP? I'm coding procedural atm but the more I code the messier it gets.. Quote
Spudinski Posted July 24, 2012 Posted July 24, 2012 I use http://www.oodesign.com/ for designing structures. A very good site, and it contains most of the fancy words programmers use when speaking about OO jargon nowadays. 1 Quote
Djkanna Posted July 24, 2012 Posted July 24, 2012 I think the only design pattern I use willingly, is the singleton pattern. Found it relatively useful to use as a quick wrapper for PDO/MySQLi etc. Quote
Spudinski Posted July 24, 2012 Posted July 24, 2012 I think the only design pattern I use willingly, is the singleton pattern. Found it relatively useful to use as a quick wrapper for PDO/MySQLi etc. Each serve their own purpose. Quote
a_bertrand Posted July 24, 2012 Posted July 24, 2012 In PHP I code mainly procedural, and I don't remember to have ever used a design pattern. However I use PHP only for my hobbies since a couple of years. At work I use C# / .NET and there I code exclusively in OO, with a lot of design pattern usages: singleton, object pool, factory, injection, observer, composite, command pattern are the one I use more frequently. However you may very well code without knowing them, and actually implement one of those pattern without actually knowing it. Why? Because some are so generic like the composite pattern that you may end up using it by chance. For your messy code, this is usually due to an initial design which didn't took in account all the needs, and / or is not flexible enough to change over time. However as the project grows / take ages, it's good practice to re-think it and restart from scratch. How often depends on your code, and project, some projects could be rewritten nearly on each major release, or 2 releases or some other projects can survive 10 years or more. Quote
dnenb Posted July 25, 2012 Author Posted July 25, 2012 Thanks for your answers, they are helping! Quote
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.