Putting Html code in php is the worst thing a serious programmer should do.
Classe don't have a getter and/or a setter method for reading/writing attributes (no information hiding, a thing on wich oop is based)
upper case characters are used for class attributes.
DocComment is neither well formed nor used for every method.
Programming style is linear but not standard.
However the package should be really useful.
Cesar D. Rodas - 2007-12-15 16:29:55 - In reply to message 1 from andrea
Can u explain why put HTML is worst? If you don't understand HTML that's your problem ;). This did this class like this for save time at the time of made a CRUD (the most common task for almost every programmer). What I'll do is generate the template the first time. Then the programmer will be able to modify the template.
And all what you wrote are only conventions, my code is not wrong if I break some of them ;). Example, the class doesn't need a setter or getter because all parameters are set in the constructor.
Use setter/getter for hide information is for PHP5 and greater (private, public), you can do that, but almost all my projects are PHP4 compatible.
"Upper case characters are used for class attributes" this is java convention.
"DocComment is neither well formed nor used for every method." I'll fix this.
"Programming style is linear but not standard." I don't understand this point, could you clarify please?
Thank your comments, I'll take time this weekend to made the code more readable.
andrea - 2008-01-06 11:22:28 - In reply to message 2 from Cesar D. Rodas
Sorry I almost forgot the discussion!
I'm talking about having presentation into behavioral code, if your class should be used in a different environment the class shouldn't return any output but error messages (raising exceptions or using error codes for template-side error management).
In my opinion, in an application, the code shouldn't know about the final rapresentation of it's behavior.
The same is for example with html and css, html describes just how the document is made, css describes how the document should be seen.
Imagine two people, a designer which works only with html and a programmer that should only work with php.
If the designer wants to add something to the output he MUST NOT see the php code because he's a designer (and even doesn't know what the code does), he works only with visual representation of what code does.
and equal, if a programmer have to path something, he must not have presentation code into behavioral code.
It make sense of thinking about a designer that modify the behavior of the application for editing it's representation.
this is my point of view.
Php4 is gone, switch to php5 as soon as possible :D
Yep the rest are just conventions, so do everything you want :)
I've noticed you don't have a real standard way to write code, so i found different styles of programming within the same file.
Kuweka code ya Html katika php ni kitu mbaya zaidi programu mbaya inapaswa kufanya. Classification ni rahisi na rahisi kwa sababu hakuna njia ya kuweka au kusoma sifa (kwa hivyo, hakuna njia ya kuificha habari, ni kitu ambacho OOP inategemea) na kwa sababu ya hali ya hali ya juu, sifa za darasa hutumiwa. DocComment ni wala vizuri kufanyizwa wala kutumika kwa kila njia. Mtindo wa programu ni linear lakini si kiwango. Hata hivyo mfuko unapaswa kuwa kweli muhimu. "Kama ilivyoelezwa katika makala ya ""HTML"" ya mwaka 2007 na ""HTML"" ya mwaka 2007 ya ""HTML"" ya mwaka 2007,"" kwa nini HTML haifanyi kazi vizuri?" Kama huelewi HTML kwamba ni tatizo lako ;). Hii ni kwa sababu ya kuokoa muda wakati wa kufanya kazi ya CRUD (kazi ya kawaida kwa karibu kila programu). Nini mimi itabidi kufanya ni kuzalisha template mara ya kwanza. Kisha programu itakuwa na uwezo wa kurekebisha template. Na yote uliyoandika ni mikataba tu, kanuni yangu si makosa kama mimi kuvunja baadhi yao ;). Mfano, darasa haina haja ya setter au getter kwa sababu vigezo vyote ni kuweka katika constructor. "Kutumia ""setter"" au ""getter"" kwa hide habari ni kwa ajili ya PHP5 na zaidi (binafsi, umma), unaweza kufanya hivyo, lakini karibu miradi yangu yote ni PHP4 sambamba." "Herufi kubwa hutumiwa kwa sifa za darasa" hii ni mkataba wa java. "DocComment ni wala vizuri iliyoundwa wala kutumika kwa kila njia". Mimi itabidi kurekebisha hii. "Mstari wa programu ni linear lakini si kiwango". Sielewi hatua hii, unaweza kufafanua tafadhali? Shukrani kwa maoni yako, mimi itabidi kuchukua muda mwishoni mwa wiki hii kufanya kanuni zaidi readable. "Mwanzoni mwa wiki hii, ""Msemaji"" alitoa ujumbe wa kwanza kutoka kwa Cesar D. Rodas, ""Sijui, karibu nisahau mazungumzo!" "Kama unafanya kazi kwa kutumia code ya tabia, ikiwa darasa lako linapaswa kutumika katika mazingira tofauti, darasa hilo halipaswi kurudi matokeo yoyote isipokuwa ujumbe wa makosa (kuinua ubaguzi au kutumia nambari za makosa kwa usimamizi wa makosa ya upande wa template).""" Kwa maoni yangu, katika maombi, kanuni haipaswi kujua kuhusu rapresentation ya mwisho ya tabia yake. Kwa mfano, HTML na CSS zinaelezea jinsi hati hiyo ilivyotengenezwa, CSS inaelezea jinsi hati hiyo inapaswa kuonekana. Fikiria watu wawili, mbuni ambaye anafanya kazi tu na html na programu ambayo inapaswa kufanya kazi tu na php. Kama designer anataka kuongeza kitu kwa pato yeye lazima kuona kanuni ya PHP kwa sababu yeye ni mbuni (na hata hajui nini kanuni hufanya), yeye kazi tu na uwakilishi wa kuona ya nini kanuni hufanya. Kwa mfano, programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu ya programu. Ina maana ya kufikiri kuhusu mbuni kwamba kurekebisha tabia ya maombi kwa ajili ya uhariri ni uwakilishi. hii ni mtazamo wangu. "PHP4 ni gone, kubadili kwa PHP5 haraka iwezekanavyo. ""D: Ndiyo, mapumziko ni tu mikataba, hivyo kufanya kila kitu unataka. ""Nimeona huna kweli kiwango njia ya kuandika code, hivyo mimi kupatikana mitindo tofauti ya programu ndani ya faili moja."