IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Re: inline PHP code and HTML
While I understand the initial atttraction of this capability - it turns out that mixing presentation and processing logic turns into a maintenance nightmare down the road.

That said - there are two critical things to look at when evaluating the "goodness" of your system.

First is multiple instances of similar chunks of code - ie "copy & paste reuse". How you minimize this (whether via copy files/file inclusion or formal functions) doesn't matter - only that you do minimize it - lest you need to change the behavior of one of these little multi-nuggets and find yourself making a dozen identical changes in various places.

Second is understandability - 1 function == one thought. As Jim said - if you feel like you need a comment - you really need a well named function instead. So you use functions to reduce clutter and give you the ability to view your software at various layers of abstraction easily. Like Drew's example - at the coarsest level his main function neatly describes the processing logic of the program at a high level - but if you want more detail you dig into the definitions of the functions - like using a zoom lens.



Smalltalk is dangerous. It is a drug. My advice to you would be don't try it; it could ruin your life. Once you take the time to learn it (to REALLY learn it) you will see that there is nothing out there (yet) to touch it. Of course, like all drugs, how dangerous it is depends on your character. It may be that once you've got to this stage you'll find it difficult (if not impossible) to "go back" to other languages and, if you are forced to, you might become an embittered character constantly muttering ascerbic comments under your breath. Who knows, you may even have to quit the software industry altogether because nothing else lives up to your new expectations.
--AndyBower
New Copy and Paste vs Functions.
We have a strong culture against copy-and-paste. Of over 300 files, we have two extant examples of copy-and-paste. Both are the To Be Fixed list: one just happened as one page's capabilities began approaching what another page did (no, they don't do the same thing, but they do it in the same way, if that makes sense). The other is basically a hack to support differing clients requirements. We don't like it but no-one will give us time to do it properly for everyone.

Re: Need to Comment = Should make a Function. I have a problem with this, especially when the commented code is only 4 or 5 lines, because you end up with a dozen or so functions that get called once. I guess this is a problem of where the abstractions occur. We're gradually sorting out these abstractions, though doing it within the page hasn't been a visible priority yet.

The guy challenging us on this also cited readability and maintainability. Unfortunately, he's not been here very long and is making his opinions known quite strongly. I admit I have a problem with his "This is just so wrong!" approach... the phrase about flys, honey and vinegar springs to mind. :-)

Wade.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

New Nothing wrong with 12 4-5 line functions
Just about right, I'd say.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Typical size of a method in Smalltalk is probably 4-5 lines
Anything over 10 is generally considered huge.



Java is a joke, only it's not funny.

     --Alan Lovejoy
New Um. Yabut.
We are basically comparing nice OO technique (and environments) to a glorified templating language. OO is naturally going to be more distributed in its processing (think: 4 objects to achieve one process versus 4 objects within a single process). Given the PHP environment I'm not sure it's "better" to shoot for more modularity. Apples and oranges.
"There's a set of rules that anything that was in the world when you were born is normal and natural. Anything invented between when you were 15 and 35 is new and revolutionary and exciting, and you'll probably get a career in it. Anything invented after you're 35 is against the natural order of things."

Douglas Adams
New I was wondering how to say that. :-)
I've found that PHP doesn't immediately lend itself to creating multiple levels of abstraction. You have to build your own framework to do that. Unfortunately, it become obvious when you have a large enough project that it's a PITA to retrofit. Except you need it. :-/

I have to repeat here that there is still a lot of code and design in our application lying around from the very first PHP version. Every page still requires register globals enabled, for example! It would be great if we could fix all that, but time is horribly against us. PHP was a great choice in the beginning, but we are about to seriously begin looking at what to rewrite the thing in. PHP may be retained for the HTML generation, though I have my doubts.

Wade.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

New I'm going for fairly strict layout/form/content separation
...which I do a poor job of describing here: [link|http://www.endue.org/endue/design/interfacelayer.htm#chunking|http://www.endue.org...ayer.htm#chunking]

Basically, the .html files get as small as:
<tr valign='top'>\n   <td><nobr><select name='ContactType'>%(TypeOptions)s</select></nobr></td>\n   <td><input type='text' name='ContactNum' value='%(Number)s' size='20' /></td>\n</tr>


...and a Python script uses an "assembler" class to interpolate values. Working very well so far.
"There's a set of rules that anything that was in the world when you were born is normal and natural. Anything invented between when you were 15 and 35 is new and revolutionary and exciting, and you'll probably get a career in it. Anything invented after you're 35 is against the natural order of things."

Douglas Adams
New Do I smell another "OO is better abstraction" war brewing?
I've found that PHP doesn't immediately lend itself to creating multiple levels of abstraction.

"Abstraction" is a rather misused and/or subjective buzzword these days. Can you identify a specific fault of PHP? (Other than lack of named parameters and lack of function nesting?)

there is still a lot of code and design in our application lying around from the very first PHP version. Every page still requires register globals enabled, for example!

That is a fault of history, not the current language. How is rewriting your PHP for better session management an inferior solution to say moving to JSP or EJB? Java for web is anti-productivity bloat.
________________
oop.ismad.com
New That is a fault of history OF the current language.
But I AM Napoleon!!!!!


--Napoleon, in "Napoleon Bunny-Part", 1956
"There's a set of rules that anything that was in the world when you were born is normal and natural. Anything invented between when you were 15 and 35 is new and revolutionary and exciting, and you'll probably get a career in it. Anything invented after you're 35 is against the natural order of things."

Douglas Adams
New So you reject a language because
...they made a bad decision in the past which was later corrected?
________________
oop.ismad.com
New Not at all.
So you reject a language because...they made a bad decision in the past which was later corrected?


Nope. I'm not in the business of rejecting languages. But Wade seemed to imply that the "bad decisions" were exacerbated by the structure of PHP itself.

In domains where I don't have direct analytical experience, I have to trust someone else's analysis; the world's too big to decide everything on my own from square one. I don't use PHP, but I have experienced similar environmental issues in my own life. Wade's description fits patterns I have observed; I trust his analysis and conclusions more often than yours as a rule. You want a more detailed discussion, you'd have to talk to Wade.
"There's a set of rules that anything that was in the world when you were born is normal and natural. Anything invented between when you were 15 and 35 is new and revolutionary and exciting, and you'll probably get a career in it. Anything invented after you're 35 is against the natural order of things."

Douglas Adams
New not very nice wording, if you ask me
but I have experienced similar environmental issues in my own life. Wade's description fits patterns I have observed; I trust his analysis and conclusions more often than yours as a rule.

A more diplomatic way to say such may be something like, "His thinking style and experience seem to better match my own than yours".

My techniques work (at least if you think like I do). Tables are objectively more compact information-wise because they use context instead of localized attribute labels/methods to specify what an attribute is. And, I think most would agree that one can see more row-wise and column-wise patterns in attributes as a table than as a bunch of linearized class attributes or XML. I am simply applying these universal truths to software development. Plus, one can do relational algebra and other table-browser tricks on tables to customize your view of the attributes. You are not stuck with Bill Gates' or Gozling's view of the friggen code. TOP gives me the freedom to see bunches of attributes as *I* want to see them, filtered row-wise, column-wise, and join-wise how I want. I become the master of my working domain, not Gozling. It seems so obvious to me. Why most of you want that tangled, static, linearized, 60's navigational-DB-style mess, I have no friggen idea. You people have weird brains. I better clone myself 100 times before more OO and array heads reproduce and kill off the last table fans.
________________
oop.ismad.com
New Then you might have guessed I wasn't trying to be diplomatic
New Not unless you're spoiling for a fight.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

New No, fighting the spOOilings
________________
oop.ismad.com
New Hey Bryce...
...don't know if you keep up with such things but I did run across your name and a pointer to your website in a footnote on page 871 of the [link|http://www.oreilly.com/catalog/oraclep3/|PL/SQL Programming] book.
New Perhaps
...don't know if you keep up with such things but I did run across your name and a pointer to your website in a footnote on page 871 of the PL/SQL Programming book.

I remember about 1.5 years ago some guy emailed me asking for permission to use my link in the citation section of his book. Perhaps this is the one. I assume it says something like, "For some possible criticism of OOP, see.....". Some university also wanted to cite my site in a published study of theirs, but wanted to know if I also had some published articles with similar content since websites alone were not acceptable to their publishers, they said.

My website is #4 under "OOP" in Google. Companies would pay zillions to be #4. You can attribute its "popularity" to its worthiness as content, or my shear persistence in spamming all the discussion boards :-) Take your pick.

________________
oop.ismad.com
New I've read way too many Oracle books lately
The exact footnote is:

* See "Object Oriented Programming Oversold!" by B. Jacobs, [link|http://www.geocities.com/tablizer/oopbad.htm|http://www.geocities...blizer/oopbad.htm]


The longer context is as follows:

[link|http://www.oreilly.com/catalog/oraclep3/|Pontifications]

I have to confess that I started programming before object approaches made any kind of inroads into business application development. I think I'm still waiting for that to happen.

Over the years, I've seen no compelling evidence that any particular programming style has a monopoly on the fundamental things we care about - fidelity to requirements, performance efficiency, developer effectiveness, and system reliability. I have seen a lot of fads, bandwagons, hand-waving, and unsupported assumptions (OK, I'm probably not entirely innocent myself), and object-oriented programming seems to attract quite a lot of it. That isn't to say that OOP fails to help you solve problems; it's just that OOP is not the magic bullet that many would have you believe.

Take, for example, the principle of object-based decomposition, particularly as it tends to generate inheritance hierarchies. By accurately modeling objects as they exist in the real world, software artifacts should be easier to comprehend, faster to assemble, and more amenable to large-scale system development. Sounds fabulous, doesn't it? Well, there are a lot of different ways to decompose something drawn from the real world.* It is a rare taxonomy that can exist in a simple hierarchy. My library catalog hierarchy could have been decomposed according to, say, media (print versus audio tape versus digital format....). And although Oracle provides wonderful tools for type evolution, it may still be so painful to make sweeping changes in a tyoe hierarchy that it will never happen. This isn't really the tool's fault; reality has a way of circumventing even the best-laid plans.

Nor is it clear that co-locating the programming logic (methods) with the data (attributes) in an abstract datatype yields any measurable benefits. It looks reasonable and makes for some great sound bites, but how exactly will coupling data and behavior be better than keeping data structures (logical and physical table design) seperate from processes (procedures, functions, packages)? Many development methods acknowledge that an organization's business data structures have a much slower rate of change than do the algorithms that manipulate them. It is a design truism (even for OOP) that the more volatile elements of a a system should be kept seperate from the more stable elements.

There is considerable inconsistency on this last point. Rich and famous object evangelists, while emphasizing the value of bundling data with behaviors, simultaneously promote a "model-view-controller" approach that "seperates business logic from data." Are these emperors wearing clothes or not?

Many OOP proponents have argued for years that its greatest benefit is the reuse of software. It has been said so many times that it must be true! Unfortunately, few observers have hard evidence for this, in part because there is no consensus on what constitutes "reuse". Even object apologists began promoting higher-level "components" (whatever those may be) as a preferred unit of reuse precisely because objects proved very difficult to fit into situations beyond those for which they were designed. My sense is that OOP results in no more code reuse than well-designed subroutines.

New thanks for the quote
________________
oop.ismad.com
     Question about programming with functions. - (static) - (47)
         Code that's called once... - (admin) - (21)
             What he said, with more detail - (drewk) - (20)
                 Re: What he said, with more detail - (deSitter) - (2)
                     Uhh, HTML *is* structured - (drewk) - (1)
                         HTML not a page definition language - (deSitter)
                 What he said, and what he before him said ... - (JimWeirich) - (15)
                     Someone confirm/deny what I was told - (drewk) - (13)
                         Depends on the language - (admin) - (7)
                             Re: Depends on the language - (deSitter) - (2)
                                 Sounds more like FORTRAN - (tuberculosis) - (1)
                                     Yes, very FORTRANish - (admin)
                             Different reason for that, I believe - (drewk) - (3)
                                 We did testing... - (admin) - (2)
                                     D'oh! - (drewk) - (1)
                                         ROFL. -NT - (admin)
                         I have a 1GHz laptop - (tuberculosis) - (1)
                             Or better yet - (Arkadiy)
                         Re: Someone confirm/deny what I was told - (JimWeirich) - (1)
                             Yeah that guy gets around! - (tuberculosis)
                         Puh-LEEEEZE! - (jb4)
                     How big a block? - (static)
                 Pascal has one up on PHP - (tablizer)
         Re: inline PHP code and HTML - (tuberculosis) - (18)
             Copy and Paste vs Functions. - (static) - (17)
                 Nothing wrong with 12 4-5 line functions - (admin)
                 Typical size of a method in Smalltalk is probably 4-5 lines - (tuberculosis) - (15)
                     Um. Yabut. - (FuManChu) - (14)
                         I was wondering how to say that. :-) - (static) - (13)
                             I'm going for fairly strict layout/form/content separation - (FuManChu)
                             Do I smell another "OO is better abstraction" war brewing? - (tablizer) - (11)
                                 That is a fault of history OF the current language. - (FuManChu) - (4)
                                     So you reject a language because - (tablizer) - (3)
                                         Not at all. - (FuManChu) - (2)
                                             not very nice wording, if you ask me - (tablizer) - (1)
                                                 Then you might have guessed I wasn't trying to be diplomatic -NT - (FuManChu)
                                 Not unless you're spoiling for a fight. -NT - (static) - (1)
                                     No, fighting the spOOilings -NT - (tablizer)
                                 Hey Bryce... - (ChrisR) - (3)
                                     Perhaps - (tablizer) - (2)
                                         I've read way too many Oracle books lately - (ChrisR) - (1)
                                             thanks for the quote -NT - (tablizer)
         Re: Question about programming with functions. - (JayMehaffey)
         Code as a Communications Tool - (gdaustin)
         Code for readability - (broomberg) - (3)
             Profiling and optimizing. - (static) - (2)
                 Difficult to optimize the algorithm after the fact - (broomberg) - (1)
                     Yes, I know. - (static)

Your configuration just allows perl programs to error out faster.
96 ms