Strong code vs working code

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Yossarian
Forum Contributor
Posts: 101
Joined: Fri Jun 30, 2006 4:43 am

Post by Yossarian »

Everah wrote:Standards can be set by an individual or organization. Best practices are usually developed by an industry. But just because they are best practises doesn't mean they are end-all, be-all to everything related to your industry. They are just what are commonly accepted values related to your industry. That is why there are best practises AND standards. The key is to adopt one and follow it consistently within the scope of control for your position. They cannot be imposed on others and typically attempting to do so results in frustration and opposition.
The industry has a tendency of getting its way though...

I work for myself, but I was really quite surprised to see so many jobs going - but the majority are fast and dirty £20-25k pa'ers.

I noted recently vacancies for PHPers with strong OOP skills, and even some call for named framework knowledge claiming to pay £10k pa more ....

The ability to work within a team, and ready to hit the ground running with cvs-subversion, unitTesting skills is being recognised and rewarded too.

I really think the Zend PHP5 certification scheme is going to help the hirers, and don't be surprised to see a Zend Framework Engineer Certificate in the next 12-18 months either.

Its all getting rather serious.... if the average PHPer does not get his skates on he/she is going to be watching retrained Java Coders eating their lunch.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Everah wrote:Well, I suppose I should claify that choosing to adopt a standard that is not exactly in line with the Best Practises of an industry does not in any way imply the use of worse standards. Who said that Best Practises are the best methods? Who said those methods will fit my business rules within the scope of my need for the technology in that industry?
I am not sure what you mean by "Who said that Best Practises are the best methods?" If they are not the collective wisdom of the industry then they are just somebody's opinion and not Best Practices. Perhaps people think they are just somebody's opinion?
Everah wrote:What I am saying is that, while best practises exist, there needs to be some common sense applied to the adoption of those practises. Just because someone puts a list of ideals into a collection called best practises doesn't make them the best way. Moreso if you get more specific to an field within the industry. However, a standard can be developed that is visible, clearly spelled out and clearly agreed upon by those members utilizing that standard in a way that makes deviating from that standard as visible as the standard itself. This ensures consistency and the commonization of practises within your scope of work within your area of the industry in which you are a part.
Again you say "Just because someone puts a list of ideals into a collection called best practises doesn't make them the best way. " Best Practices are not ideas, but are usually very practical, down to earth things. And if they are not considered to be "the best way" then you are back to any practice is ok and the deciding factor on how grumpy and inflexible the programmer is.
Everah wrote:I may not be stating my position correctly, but I am not advocating 'worse practises' by saying that best practises are not necessarily relevent to a particular segment of an industry.
Not sure what you mean by "a particular segment of an industry"?
(#10850)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What are the best practises for PHP application development?
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Let the tradesman wield tools, not the tools the trademan...:).

I think the gist of the what a few people are saying is that TDD, Agile Methodologies, and such are valuable practices (which work in my experience regardless) but which aren't always conducive to getting a project finished within budget. It's true at times and makes sense. I do note that over the past year I've worked on projects at work which have slowly (really slowly :roll: ) implemented these to great advantage. It's just that sometimes you just need to throw them out for short periods to attain a target. Thye flipside, is that you pay for it later but often that's quite acceptable for the short term goal.

Edit | I should emphasise that even the budget is short term. What I wrote suggested in one line dropping the practices for the whole length of a project - which makes no sense personally. Presumably no one disagrees a from-scratch project will suffer from using TDD etc. in the long term.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

TDD, Agile Methodologies, and such
What I am saying is that these practises can be applied to the programming industry. But when it comes to a specific segment of the industry (PHP application development, desktop programming, etc), these practises may not apply in as relevent a manner as to the overall industry. In these circumstances standards can (and should) be established within the more specific scope. If these standards do not utilize the best practises it doesn't mean that they are utilizing worse practises, it just means that for the specific section of the industry for which the standards are being developed that those best practises may not be adopted. That is all I am saying. Not that they are good or bad (because I agree that industry best practises are a good thing) but that they may not be relevent to a more specific level and that, in those times, a developed and followed standard is still a viable tool.

I think my head hurts now and if I don't get some form of fast food in me I am going to get cranky and hungrier. I'll leave the remainder of this discussion to those folks that have a better understanding of the content in this thread.
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

Wish the participant in this topic would define "best practice" and "methodology" because your confusing the hell out of me? Personally I think they're two different things. TDD, for example, can be applied to any programming language however many best practices are specific to a programming language and may even be dependent on the specific implementation of a programming language. To me a methodology does not guarantee the use of the best practices. Of course maybe I'm just loaded to the Gunwales? Aye Mateys.
Let the tradesman wield tools, not the tools the trademan.
Like that one.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

arborint wrote:I am regularly confused by these converstations. It sounds like you are saying that because best practices are not "be-all, end-all" that you should choose worse practices?
Thats not what I mean when I say the same thing...

Design patterns are just that, their patterns, not strict implementations or holy bibles to build software by. I find you overly zealous towards their promotion and practice, nothing wrong with that. However my point is, you may see myself as naive to their cause, but in the same light I may see you as just the opposite. See where I'm coming from?

As an experienced developer I can see their use and have even reviewd many existing frameworks developed by the best programmers in the world and have be able to map some similarities to existing patterns to their design. But often, in my own cases and others those design patterns are broken (when someone is as strict about their use or definition as you are).

I often get the impression you are suggesting anyone who follows a design, but not *exactly* as Martin Fowler explains it is doing wrong and is clearly an inexperienced developer. Making me wonder who you or Martin Folwer are

Tony Marston(sp?) has recived flack by many a developers because of his implementation of OOP and yet he been a professional developer for something like 20 years, which is a long time. So I'm sure he knows what works and what doesn't.

Just recently (as you may recall) I was working on an MVC framework in which I wanted to somehow support both model 1 and model 2 paradigms. That was the end goal as supporting both would likely seem the best idea. However after some thought it appeared to be impossible to implement strictly following design pattern guidelines, as a page controller and front controller are quite different.

So I modelled my software *after* known existing patterns as opposed to following them 100% to definition, thus I was capable of supporting both a model 1 and model 2 using the same codebase, basically using an extended version of the base class.

This is an excellent example of where academia and real world collide. It was practical for me to support both models, not one or the other, but following strictly what design patterns dictate would have required more likely than not a slightly different codebase to suport both, whereas I managed to implement model 1 as a base class and model 2 as an extended class of the base class so using one over the other is as simple as deriving your class from the appropriate model1 or mode2 classes.

That switch is crucial as I want it to bes as seamless as possible to switch from one model to the other for client developers.

ASP.NET forces you into using a page controller design, whereas many PHP frameworks support front controller design. I wanted to support both!!! I should note I have found an article on implementing front controller in ASP.NET but it's alot of additional work.

Anyways, my point is, my experience has taught me, that every situation is different and every developer is different. I have good ideas too, some are damn good ideas others are complete failures. I have spent years toiling over how to best design or implement a solution, maybe even as long as Fowler has, who knows (likely not he appears quite old). I can't personally follow in the foot steps of someone just because.

I have read much of design patterns lately, UML, TDD, etc...and none of it is really *new* or amazing, in fact, it's just formalized what I've already pretty much done for the last 15 or so years I've been seriously into programming.

Methodologies are hard pressed to be rapdily adopted, not because they don't make sense or because they go against existing known knowledge, but becayse, their nothing new to an experienced developer (hence the old timers reluctance I imagine) just refined ways of doing something. So many are forced to ask the question: "Should I spend time formalizing what I already know"

Well, for a young programmer like me, the answer was 50/50 yes and no...so I'm absorbing it slowly, learning as much as nessecary to better understand what it is i'm doing. Others maybe not.

The point is, their patterns, not blue prints like some articles or books may suggest. They are quasi-models which are likely best for new programmers to observe, as experienced developers should already have many of them hammerd out and just need formalizing for the sake of nomenclature ;) Vocabulary is important when trying to describe something and is what I have found most udeful in learning design patterns, no longer am I stuck spending greats deals of time toiling over commenting code sections. Another thing I have learned over the years is that techniques change faster than my socks, so to obsess with any one model or method is pointless - because next year Joe Blow will propose an entirely different outlook on things and make the exact same claims about how it will change they way you do business.

Cheers :)
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Buddha443556 wrote:Wish the participant in this topic would define "best practice" and "methodology" because your confusing the hell out of me? Personally I think they're two different things. TDD, for example, can be applied to any programming language however many best practices are specific to a programming language and may even be dependent on the specific implementation of a programming language. To me a methodology does not guarantee the use of the best practices. Of course maybe I'm just loaded to the Gunwales? Aye Mateys.
For me, Best Practices are things like using version control, low-coupling / high-cohesion, peer review, using pattern language, etc. Methologies are organized ways of doing things that usually combine Best Practices into a process, for example test first or pair programming. Best Practices often map onto Methodologies, for example pair programming is a way to achieve peer review.
(#10850)
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

arborint wrote:For me, Best Practices are things like using version control, low-coupling / high-cohesion, peer review, using pattern lanugage, etc. Methologies are organized ways of doing things that usually combine Best Practices into a process, for example test first or pair programming. Best Practices often map onto Methodologies, for example pair programming is a way to achieve peer review.
I'd agree "low-coupling / high-cohesion" is a best practice. However, 'version control, pair programming, peer review, pattern lanugage' seems more like methodology to me. We just see things different ... what's new? :D At least, I'm a little less confused.
draco2317
Forum Newbie
Posts: 19
Joined: Mon Sep 18, 2006 9:17 pm

Post by draco2317 »

So I guess what i have learned by sitting back and observing this thread, was learn what you can, discuss the code you write with peers, (in my case superiories :) ), and read new stuff. After all this, 20 years of experience someones code will still be criticized no matter how good they become, lol. Seriously though, its actually good to know that there are so many people willing to help others out. Also its nice to see how passionately programmers are about defending their ideas and interpertations, while respecting others point of view (for the most part.)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

draco2317 wrote:So I guess what i have learned by sitting back and observing this thread, was learn what you can, discuss the code you write with peers, (in my case superiories :) ), and read new stuff. After all this, 20 years of experience someones code will still be criticized no matter how good they become, lol. Seriously though, its actually good to know that there are so many people willing to help others out. Also its nice to see how passionately programmers are about defending their ideas and interpertations, while respecting others point of view (for the most part.)
Heck yeah we'll criticize your code. Of course, it is only to stroke our own egos :wink:. No wait, that is just me. The rest of the folks here actually have a genuine interest in helping people. That is why we spend so much time here.

Stick around here long enough and you will find that we all are very helpful, annoying, critical and funny, if not mildly strange, disturbed or overly zealous to our own ways of thinking. That is what makes us the group we are.

EDIT | Seeing as the descriptive term goup was not easily interpreted, I have modified the term to make it more user friendly: I now present to you -> GROUP. Thank you, thank you. It was the least I could do.
Last edited by RobertGonzalez on Wed Sep 20, 2006 10:55 am, edited 2 times in total.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Goup? ;) A new buzzword for a totally weird clique of fanatic PHP users?[/img]
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

Maugrim_The_Reaper wrote:Goup? ;) A new buzzword for a totally weird clique of fanatic PHP users?[/img]
am I in the goup? :)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

After figuring out that I spelled a word wrong, I felt like I was in the goup. :cry:
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Comic relief from a potentially argumentative topic is never to be underestimated... :lol:
Post Reply