2008. 02. 27, szerda keltezéssel 12.45-kor Nathan Nobbe ezt írta: > On Wed, Feb 27, 2008 at 12:32 PM, Zoltán Németh <znemeth@xxxxxxxxxxxxxx> > wrote: > > > 2008. 02. 27, szerda keltezéssel 17.42-kor Aschwin Wesselius ezt írta: > > > Nathan Nobbe wrote: > > > > i understand designing for simplicity is key, however, things can only > > be > > > > kept > > > > so simple beyond reason. the more something does, the more complex it > > is; > > > > period. > > > > > > > > -nathan > > > > > > > > > Nice touch, but what I'm most afraid of is abstraction layers. It is > > > good to know what to abstract, but also how it is abstracted and where > > > it came from. > > > > > > Sometimes, abstraction makes it so unbelievable complex, just because of > > > the sake of abstraction (or over-engineering). Maybe it's just me, but I > > > like things clean and simple. I can't grasp oversight easily. Especially > > > when it's someone else's code. > > > > > > I do acknowledge the need (or purpose) of OOP, but sometimes you can > > > make it more clean and simple by getting rid of the clutter. If you > > > don't know anymore where the code is that you need to edit, you have to > > > read the code over and over again (parsing it in your head to something > > > that makes sense). If you have to do this 10, 20 or even 50 times a day > > > my head explodes. > > > > > > I have to deal with spaghetti code from some old code-base every day, it > > > frustrates me because I can't get inside the head of the programmer who > > > wrote this trash. Nice patterns, nice classes (not so OOP), no > > > documentation. It takes to much memory, to much included files (125+), > > > to many templates, sometimes a 1000+ queries per page (mad!). > > > > > > No. Give me procedural code please. I can read that from top to bottom, > > > it sticks on 1 flow of the processing. Downside is having some code > > > multiple times all over the place (hence an argument for OOP). But that > > > saves me time and a huge headache every day. I like it to maintain it > > > that way. And maybe the programmer after me has to clean it up too. But > > > refactoring procedural code is way easier that refactoring OOP code is > > > my opinion. > > > > > > > > > > nowadays I work on a project which currently has 413415 lines of php > > code in hundreds of files, part of which are generated by the other > > part, but at least half of it is coded by us... its well-structured oop, > > we know we're using some patterns like mvc, singleton, registry, factory > > and there may be several ones we are using without knowing. > > now please tell me can you read 413415 lines of code from top to > > bottom? ;) > > (and before anybody asks, no that number does not include the framework > > -symfony- and the orm -propel- we are using, only the propel generated > > object classes and the classes generated by our generator and the > > classes written by ourselves) > > > > thanks to its good class structure if we need to modify something we > > know which file to open and where to modify, even if that class was > > originally the work of someone else in the team. how would you do that > > without class structure? > > > if i were going to design a system consisting largely of functions, i would > use the same practice i use for designing classes; each function would be > concise. that is, if functions became large, eg over 20 - 30 lines (NOTE: > this value is obviously not a scientific coefficient) then i would probly > try > to rethink them. and per organizing the functions, i would group them in > files that indicated related functionality. > if i were to design a procedural system, i would do the same thing still; > except that each file would essentially be 'a function' and the 'parameters' > would be the global variables expected by said file. there would be probly > some sort of validation script, to ensure required variables were supplied; > that one would be included a lot ;) > but for me i choose classes; why; (and im not starting another holy war, for > real ;)) i started out coding on c++ then to java, now to php; i suppose i > never learned, or had any need to learn techniques of building complex > systems with functions and/or procedural code. yes, i started out w/ basic > back on the ti-86 if you really want to get down to it and i had a lot of > gotos > in there; w/ lots of 3 letter variable names. some of my programs were a > couple thousand lines of that, and i had to have an 'external document' a > sheet of looseleaf that would tell me what the variables were all really > for. > but in the current day and age ill stick w/ the status quo, the momentum, > and use classes in my code. thats what makes sense to me, and obviously > quite a few other people out there. > and yes, i use files w/ functions in them from time to time and > occasionally > sprinkle in global functions in my applications w/ classes. guess why; its > php ;) yeah, thats more or less all true for me too. (aside from the fact that I started with basic on C64 not ti-86 ;) ) classes are just sooo convenient for anything larger than a couple of files, now that I got used to them I would not go without them any more greets Zoltán Németh > > -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php