News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Reddit.com:
Worst practices
September 04, 2013 @ 11:35:52

In this recent post to Reddit.com, people have been sharing some of the "worst practices" they've seen during their PHP development (or may even be guilty of).

For shits and giggles some colleagues and I are trying to write the crappiest PHP script we can think of, using as many bad practices as we can find. Alas, it's much harder then we thought, because we all have been trained to not do stupid stuff.

Things on the list so far include:

  • Multiple class definitions in a single file
  • Saving passwords unhashed and unencrypted in a database
  • Using a global variable inside a class to get a database connection
  • One letter variables
  • Pointlessly setting the signup method to being static
  • Using GET or POST vars directly from user input
  • Mixing HTML and PHP like there's no tomorrow.
  • make liberal use of extract() after running 'SELECT *'
  • Define a custom exception class for each class and only throw it from that class.
  • Make sure your DB connection is a singleton.
  • Throw ugly constants everywhere

What are some of the worst things you've seen? Share them here.

0 comments voice your opinion now!
worst practices opinion examples list

Link: http://www.reddit.com/r/PHP/comments/1lpgqk/worst_practices

Matt Frost:
Agent of Change Part 2 Presentation
February 05, 2013 @ 09:20:35

Following up on his previous post about being an "agent of change" in your organization (work, open source project, etc) Matt Frost has posted his second part of the series focusing on the presentation of your ideas.

In Part 2 we're going to talk about presentation of the pitch you put together for this change. It's important that your pitch be well researched and in some regards provable, as the Agent of Change the responsibility lies with you to prove the value of your idea. As we touched on in Part 1, a well thought out plan is going to go a long way in breaking down the barriers that make change difficult to take hold.

He makes a strong point that you need to identify the problem you're trying to solve (and what solution you're wanting to propose) clearly before trying to present it to a listening audience. He recommends quantifying your solution in terms everyone can understand like "hours of work" or cost. He recommends coming up with a short "elevator pitch" version to entice and the longer version to fill in the gaps.

You've got slides, documentation, statistics and loads of other good information that is going to benefit your development process, sales people in particular are looking for that jewel that helps set your organization apart; you've got that jewel!
0 comments voice your opinion now!
agent change series practices development presentation


Matt Frost:
Agent of Change Part 1 Preparation
January 08, 2013 @ 09:57:35

Matt Frost has posted the first part of a series he's writing up about being an "Agent of Change" in your development organization with recommendations on how you can make changes for the better happen. In this first article, he looks at working up "the pitch" for new technology and practices.

We all to make changes that make our jobs easier, so if your change isn't meeting a need or helping to ease a pain point, it's probably not the right change. [...] Find something that makes your job harder or less enjoyable, there's a pretty good chance that you aren't the only one.

He recommends doing plenty of research before making your recommendations, especially if it's a "we should be doing, but don't know how to" kind of improvement. He uses test-driven development in his examples, with part of his pitch being that it reduces the number of bugs that make it into production.

When plans are well thought-out and researched, the element of risk that others perceive tends to dwindle. [...] It's not about pointing out the faults of others in the organization or assigning blame, it's about learning and making positive changes from the lessons you've learned.
0 comments voice your opinion now!
agent change preparation series practices development


Jonas Hovgaard's Blog:
How I stopped writing awesome code
June 14, 2012 @ 11:55:21

In this recent post to his blog Jonas Hovgaard talks about how he "stopped writing awesome code" by dropping a few things from his usual development practices - like unit tests and interfaces.

If writing awesome code is using all the best practices I can find, writing interfaces, unit tests and using top notch IoC containers to control my repositories and services all over my application's different layers - Then I'm not writing awesome code at all! I've been that guy, the one writing the awesome code, but I stopped. I'm not awesome any more. Instead, I'm productive, I'm so damn productive!

He talks about how not writing unit tests (which "customers don't care about") gave him extra time to work on other code and how not using things like interfaces, ORMs and how he follows DRY, but only so far.

My personal result of doing all of this is productivity and better products. I can't tell if I did it all wrong, and that's why I'm writing better code now, but I truly believe that I'm not alone. In fact I think that most of us regular web developers, tend to do the same "mistakes" as I did.

The post has turned into flame bait and has pulled in lots of comments discussing his decisions and other sympathetic souls that feel the same way he does about some of the complexity of the "best practices" promoted in development today.

0 comments voice your opinion now!
opinion development practices bestpractice unittest interface orm dry


PC World:
How Etsy.com Grows in a Unique Fashion
April 03, 2012 @ 09:08:08

Over on the PC World site, there's a new article posted about Etsy and its development practices and how it "grows in a unique fashion" because of them.

The Etsy staffers are also completely serious about their work, and these two features they share in common with their customer base, who are tying to earn side money, if not pay the rent, by designing the hand bags, walking sticks and hand-made chocolates that have made Etsy famous in the artisan and sustainable business scene. [...] The quality model for Etsy is cutting edge, but not unique. New developers are expected to push code to production on day one. That's not commit code, but push it to production.

The article gets into some of the technology they use there at Etsy (including NodeJS, Nagios and, of course, PHP), the atmosphere they try to maintain, how they do their code deployment and how they conform to various regulations, security and privacy concerns.

0 comments voice your opinion now!
etsy growth developer practices interview


Ed Finkler's Blog:
The MicroPHP Manifesto
January 03, 2012 @ 10:46:40

Ed Finkler has put together what he calls the MicroPHP Manifesto, a call to arms for the PHP community to get "back to the basics" and focus more on things like good well-crafted code rather than extending out into "complex, verbose solutions."

The approach I've been taking lately is to start with as lightweight a foundation as possible, in the form of a "microframework." [...] For additional functionality, I pull in lightweight libraries that help me accomplish only the tasks I need. Clarity and brevity are my top considerations. My other big consideration is the commitment I make when I use code I didn't write.

He goes on to talk about difficulties finding lightweight libraries to suit his needs and gives some cloc benchmarks for the Symfony HttpKernel and the Slim and Epiphany microframeworks. The end of the post is the most important part - the manifesto itself...one he hopes will ring true with the development community. It includes things like:

  • "I am a PHP developer. I am not a Zend Framework or Symfony or CakePHP developer."
  • "I like building small things with simple purposes."
  • "I need to justify every piece of code I add to a project."
  • "I want to write code that's easily understood."

For more read the full post over on his blog.

0 comments voice your opinion now!
manifesto opinion development practices


Nikita Popov's Blog:
Don't be STUPID GRASP SOLID!
December 28, 2011 @ 09:26:14

Nikita Popov talks about the SOLID coding practices and creates his own acronym for the complete opposite - STUPID (Singleon, Tight coupling, Untestable, Premature optimization, Indescriptive naming, Duplication).

Ever heard of SOLID code? Probably: It is a term describing a collection of design principles for "good code" that was coined by Robert C. Martin (aka "uncle bob"), our beloved evangelist of clean code. [...] So, why not approach the problem from the other side for once? Looking at what makes up bad code.

He goes through each part of his STUPID acronym and talks about how it can hurt your code and a few alternatives to help make your application more flexible and easier to maintain in the long run. He also mentions GRASP (General Responsibility Assignment Software Principles), another set of good practices to follow, some similar to SOLID, that can make your app better.

0 comments voice your opinion now!
stupid solid grasp development practices opinion


DZone.com:
Writing Better PHP Three Guides
December 14, 2011 @ 11:15:32

On DZone.com today John Esposito has posted about three guides that want to help you improve your PHP development skills (including a forum post and two articles).

Sometimes, then, improving your generic 'programming brain' will help you improve your facility with a particular language. At other times, it's more important to learn the nuances of a language, paying close attention to the kind of applications the language is used for. [...] For improving your PHP, then, you can do two things: become a better programmer; and understand PHP more finely, more deeply.

The three guides share a lot of the same concepts in common - naming conventions, separation of functionality, DRY (don't repeat yourself), testing code, etc.

0 comments voice your opinion now!
improve development practices skill guide


Pingdom.com:
Exploring the software behind Facebook, the world's largest site
June 22, 2010 @ 09:17:54

On pingdom.com there's a recent article posted looking at some of the technology behind Facebook and how they manage to keep up with the huge demand put on them and their servers.

At the scale that Facebook operates, a lot of traditional approaches to serving web content break down or simply aren't practical. The challenge for Facebook's engineers has been to keep the site up and running smoothly in spite of handling close to half a billion active users. This article takes a look at some of the software and techniques they use to accomplish that.

They have to be able to handle over 570 billion page views a month across over 30,000 servers so there's several key technologies than they use to help make this a reality. Besides the famous HipHop for PHP tool, they also use things like memcached, Cassandra, Hadoop and Varnish. There's also other non-tech specific practices they do to keep things flowing smoothly.

1 comment voice your opinion now!
facebook technology practices software


Samuel Folkes' Blog:
17 PHP Practices That Should Be Banished Forever
August 05, 2009 @ 13:37:17

Samuel Folkes has posted a few practices (seventeen, to be exact) that PHP developers should "banish forever" from their development habits.

The following is a list of 17 PHP programming practices that in my opinion should be banished into oblivion. Forever and ever. Amen. Please note that this list is in no particular order.

Some of the practices include:

  • Relying on Magic Quotes
  • Mixing HTML, PHP, SQL, JS, CSS, Etc, Etc
  • Not Documenting Code
  • Using Regex Functions for Basic String Manipulation.
  • Unquoted Array Keys
  • Using Uninitialized Variables

There's lots more where those came from so check out the rest of the list here.

0 comments voice your opinion now!
practices bad development banish



Community Events





Don't see your event here?
Let us know!


refactor list unittest code introduction release developer laravel testing series opinion community language interview threedevsandamaybe configure podcast symfony2 framework install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework