The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(Score: 1, Informative) by Anonymous Coward on Tuesday May 06 2014, @08:28PM
by Anonymous Coward
on Tuesday May 06 2014, @08:28PM (#40321)
Pipecode is somewhat of a mess, and lacks anything resembling a templating system; most of the pages appear to admit raw HTML via writeln() lines
Ack. To clarify for others; the code itself is quite clean but in architectural terms, it is not a cleanly engineered code base. Anybody who ever got a maintenance gig on this sort of code knows exactly what is meant. Those who never had to maintain a 3rd party codebase like this -- it should in no way be taken as disrespectful towards or as a criticism of Bryans efforts.
I've had a look over some of the pipedot source, and it's easy to read and understand. I prefer keep it simple, and hardcoded page generation is simple. IMHO templating is overrated unless you need to add features on a regular basis. Otherwise CSS should be good enough for most layout tweaks. Templating also adds a layer of complexity. If necessary a basic pipedot template system could be built with html includes and the use of variable delimiters like %% and php's str_replace function, but it's not like the pipedot page generation is hard to figure out and modify without it.
Nobody is criticising Bryans code, however not separating presentation from business logic is a huge red flag to me as a former freelance contractor. This is what NCommander referred to as a 'mess' and I was agreeing with that sentiment whilst pointing out why somebody would use that term. PHP is a templating language and you only have to see a couple of horror codebases before not doing something as simple as...
function view($files, $data = array()){ extract($data); foreach ($files as $file) require_once(VIEW_PATH . $file . '.php'); }
... will set cacophonous alarm bells ringing in your head. I don't see how that is overrated? It's moving all the HTML, inline script and CSS to separate files. Nothing complicated about it -- extract an array into the function scope and make the variables available to included files.
Attempting to maintain a codebase where there's javascript stored in SQL being retrieved in the middle of a HTML segment and updating inline CSS... No really -- I still have nightmares after all these years and like I said it's a red flag to me and this is quite probably why NCommander used the term 'mess'. I've no particular reason to defend the guy but am certain that I too have felt the pain.
all good points. css is usually stored in separate.css files anyway, so i don't think there is any disagreement there (and i didn't see any inline css in the pipecode files that i looked at).
javascript stored in SQL being retrieved in the middle of a HTML segment and updating inline CSS
my guess is that scenario would be closer to slashcode than pipecode
also, not saying that templating is bad... more that lack of templating isn't necessarily bad.
also, not saying that templating is bad... more that lack of templating isn't necessarily bad.
I haven't seen the code, but I will say not having templating for something like this suggests you aren't separating the layers properly. Ignoring the "smell" argument for a moment, it definitely removes flexibility.
It's like not having unit tests or FIT for code - you may be able to get away with it for a while but the first time you need to do any real work on it, especially when there is a problem you have created a mess for yourself.
Now I am curious - I think I will grab the code and take a look at it.
your argument is based on the false premise that templating is required for flexibility... it's not. if you look at the source, the page structure can be changed, quite easily too. the only difference is that you need only know a bit of php to do it and not some obscure invented templating syntax.
separation of layers is usually good, but it's not the rule, and nor should it be... because such rule itself would remove flexibility. established rules are a tool of the waterfall trade, and is also partly why waterfall projects so often fall on their swords.
do grab the code. "professional programmers" will no doubt balk at it, but from a pragmatic tinkerer's point of view, it's simple, easy to read & understand, and it works. i was able to navigate my way around pipecode fairly easily the first time i saw it. slashcode otoh, well... you can probably guess.
your argument is based on the false premise that templating is required for flexibility... it's not. if you look at the source, the page structure can be changed, quite easily too. the only difference is that you need only know a bit of php to do it and not some obscure invented templating syntax.
Nope, my argument is that proper structuring of code makes it easier to add/remove/change. Improper design makes changes harder (hence, removes flexibility) and your options fewer.
Is your argument that "templating" is something you do in "one of those (obscure invented) templating languages"? Do you believe that PHP isn't/can't be a templating language? Is Velocity or Freemarker "obscure" or does it have to have the ubiquity of JS?
Just so we are clear, I am talking about the MVC pattern - specifically the Model->View part, templating is simply mapping the data in the Model to structures in the View. Proper templating treats those a separate components so you can (re)move, add, enhance what the user sees without needing to or minimize messing with code. Ignoring the business driven decisions by Dice, do you think we would be here if the site-which-must-not-be-named had a clean template layer that you could control?
separation of layers is usually good, but it's not the rule, and nor should it be... because such rule itself would remove flexibility. established rules are a tool of the waterfall trade, and is also partly why waterfall projects so often fall on their swords.
Ah, so design patterns (MVC in this case) is a tool of the Man, and fails the People in the real world of Agile Masters. I won't get side-tracked on why waterfall and agile projects fail, but it isn't because they followed best practices. In fact, many of these "rules" were created to address project failure regardless of methodology - but likely help the faster paced development teams the most.
YMMV.
do grab the code. "professional programmers" will no doubt balk at it, but from a pragmatic tinkerer's point of view, it's simple, easy to read & understand, and it works. i was able to navigate my way around pipecode fairly easily the first time i saw it. slashcode otoh, well... you can probably guess.
I grabbed slashcode when I joined this site, and it is sitting on my computer. I meandered through it, mostly because I was interested in seeing what NCommander was talking about in some of those posts. It is a good sign that the pipedot code is easy to understand, but I just did a bender with Wordpress, so I'm not in any particular hurry to look at more PHP - but I definitely plan to. Eventually. When the mood or need strikes me.
i'm just a tinkerer... rules are meant to be broken, wheels are meant to be reinvented, and methodologies be damned. also, my idea of software design is scrawl on a bunch of sticky notes, so it's probably a good thing i'm not a pro.
(Score: 1, Informative) by Anonymous Coward on Tuesday May 06 2014, @08:28PM
Ack. To clarify for others; the code itself is quite clean but in architectural terms, it is not a cleanly engineered code base. Anybody who ever got a maintenance gig on this sort of code knows exactly what is meant. Those who never had to maintain a 3rd party codebase like this -- it should in no way be taken as disrespectful towards or as a criticism of Bryans efforts.
(Score: 4, Insightful) by crutchy on Tuesday May 06 2014, @09:50PM
I've had a look over some of the pipedot source, and it's easy to read and understand. I prefer keep it simple, and hardcoded page generation is simple. IMHO templating is overrated unless you need to add features on a regular basis. Otherwise CSS should be good enough for most layout tweaks. Templating also adds a layer of complexity.
If necessary a basic pipedot template system could be built with html includes and the use of variable delimiters like %% and php's str_replace function, but it's not like the pipedot page generation is hard to figure out and modify without it.
(Score: 1, Insightful) by Anonymous Coward on Tuesday May 06 2014, @10:11PM
Spoken like a true PHP developer
(Score: 0) by Anonymous Coward on Tuesday May 06 2014, @10:39PM
aka I like spaghetti code
(Score: 2) by crutchy on Wednesday May 07 2014, @07:50AM
wow thanks. i never considered myself to be a 'developer'... more just a tinkerer :-D
(Score: 1, Interesting) by Anonymous Coward on Tuesday May 06 2014, @11:08PM
We can have a cross-site discussion [pipedot.org] if you like :P
Nobody is criticising Bryans code, however not separating presentation from business logic is a huge red flag to me as a former freelance contractor. This is what NCommander referred to as a 'mess' and I was agreeing with that sentiment whilst pointing out why somebody would use that term. PHP is a templating language and you only have to see a couple of horror codebases before not doing something as simple as...
... will set cacophonous alarm bells ringing in your head. I don't see how that is overrated? It's moving all the HTML, inline script and CSS to separate files. Nothing complicated about it -- extract an array into the function scope and make the variables available to included files.
Attempting to maintain a codebase where there's javascript stored in SQL being retrieved in the middle of a HTML segment and updating inline CSS... No really -- I still have nightmares after all these years and like I said it's a red flag to me and this is quite probably why NCommander used the term 'mess'. I've no particular reason to defend the guy but am certain that I too have felt the pain.
(Score: 2) by crutchy on Wednesday May 07 2014, @07:56AM
all good points. css is usually stored in separate .css files anyway, so i don't think there is any disagreement there (and i didn't see any inline css in the pipecode files that i looked at).
my guess is that scenario would be closer to slashcode than pipecode
also, not saying that templating is bad... more that lack of templating isn't necessarily bad.
(Score: 1) by RaffArundel on Wednesday May 07 2014, @12:53PM
I haven't seen the code, but I will say not having templating for something like this suggests you aren't separating the layers properly. Ignoring the "smell" argument for a moment, it definitely removes flexibility.
It's like not having unit tests or FIT for code - you may be able to get away with it for a while but the first time you need to do any real work on it, especially when there is a problem you have created a mess for yourself.
Now I am curious - I think I will grab the code and take a look at it.
(Score: 0) by Anonymous Coward on Wednesday May 07 2014, @01:24PM
So for a site like this, once you've settled on a usable and not too crappy UI, the users aren't going to care if you never actually change the look.
(Score: 2) by crutchy on Wednesday May 07 2014, @09:55PM
your argument is based on the false premise that templating is required for flexibility... it's not. if you look at the source, the page structure can be changed, quite easily too. the only difference is that you need only know a bit of php to do it and not some obscure invented templating syntax.
separation of layers is usually good, but it's not the rule, and nor should it be... because such rule itself would remove flexibility. established rules are a tool of the waterfall trade, and is also partly why waterfall projects so often fall on their swords.
do grab the code. "professional programmers" will no doubt balk at it, but from a pragmatic tinkerer's point of view, it's simple, easy to read & understand, and it works.
i was able to navigate my way around pipecode fairly easily the first time i saw it. slashcode otoh, well... you can probably guess.
(Score: 1) by RaffArundel on Thursday May 08 2014, @01:03PM
Nope, my argument is that proper structuring of code makes it easier to add/remove/change. Improper design makes changes harder (hence, removes flexibility) and your options fewer.
Is your argument that "templating" is something you do in "one of those (obscure invented) templating languages"? Do you believe that PHP isn't/can't be a templating language? Is Velocity or Freemarker "obscure" or does it have to have the ubiquity of JS?
Just so we are clear, I am talking about the MVC pattern - specifically the Model->View part, templating is simply mapping the data in the Model to structures in the View. Proper templating treats those a separate components so you can (re)move, add, enhance what the user sees without needing to or minimize messing with code. Ignoring the business driven decisions by Dice, do you think we would be here if the site-which-must-not-be-named had a clean template layer that you could control?
Ah, so design patterns (MVC in this case) is a tool of the Man, and fails the People in the real world of Agile Masters. I won't get side-tracked on why waterfall and agile projects fail, but it isn't because they followed best practices. In fact, many of these "rules" were created to address project failure regardless of methodology - but likely help the faster paced development teams the most.
YMMV.
I grabbed slashcode when I joined this site, and it is sitting on my computer. I meandered through it, mostly because I was interested in seeing what NCommander was talking about in some of those posts. It is a good sign that the pipedot code is easy to understand, but I just did a bender with Wordpress, so I'm not in any particular hurry to look at more PHP - but I definitely plan to. Eventually. When the mood or need strikes me.
(Score: 2) by crutchy on Thursday May 08 2014, @02:10PM
i'm just a tinkerer... rules are meant to be broken, wheels are meant to be reinvented, and methodologies be damned. also, my idea of software design is scrawl on a bunch of sticky notes, so it's probably a good thing i'm not a pro.