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

Frank de Jonge:
A Case Against Coding Lingo
May 28, 2014 @ 10:54:14

In this new post to Medium Frank de Jonge talks about one of the infamous "two things hard about programming", namely...well, naming things.

The other day I had a small discussion on one of my open-source projects, in this case Flysystem. It was about the smallest thing ever, the name of a method. A method name that was suggested to replace another method name just didn't feel right to me. It made me wonder why. I came to the conclusion: Using lingo in code should be avoided.

He elaborates a bit on what he means by "coding lingo" and a few general things to think about when naming your methods, variables, etc. His reminders include:

  • Going for clarity
  • Remembering that not everyone is English
  • That it can be excluding
  • It can be limiting

He reminds us that naming doesn't have to be "cool", it just needs to be useful and a developer-focused kind of documentation. He recommends using common names/terms for things, being concrete and avoiding abbreviation. There's a few other recommendations in the post too, so check out the full article for more.

0 comments voice your opinion now!
coding lingo naming convention opinion recommendation

Link: https://medium.com/@frankdejonge/8ffae1a4fa4e

Pádraic Brady:
Coding Standards Humans Are Not Computers
February 11, 2014 @ 10:26:06

In his latest post Pádraic Brady shares some of his thoughts around coding standards and the existence of tools to be sure the code is exactly formatted correctly.

The problem with coding standards is not the notion of following conventions to ensure all programmer can quickly read and understand code (and other good stuff), but that someone created a tool to actually check compliance: PHP_CodeSniffer. This isn't a complaint about the operation of phpcs, but to complain about the mere fact of its existence. [...] Using the cover of such automated tools, we can make judgement calls about code quality, integrate style checks into Continuous Integration scoring schemes, complain about pull requests and patches, and generally impose a time penalty on writing code. There is a point at which common sense morphs into sheer nitpicking, and an automated tool is the perfect nitpicker.

In his opinion, coding standards should be "invisible and flexible" as well as easy to learn so the developers could learn and follow it quickly. He looks at these thoughts applied to the PSR standards and how adhering to them could quickly turn into something much more time consuming than it should. In his opinion a good coding standard is one that "limits the rules, eradicates ambiguity, formulates multiple use cases and avoids trivialities".

0 comments voice your opinion now!
coding standard psr phpcs codesniffer opinion

Link: http://blog.astrumfutura.com/2014/02/coding-standards-humans-are-not-computers/

MaltBlue.com:
5 Reasons Coding Standards Are Essential
March 13, 2013 @ 10:13:59

Matthew Setter has posted five reasons why he thinks that making a coding standard is an essential part of your development process. He suggests that "pain avoidance" is one of the key factors, both for new members of the team and for those maintaining it in the future.

Whenever you're working on a project, are you consistent? Are you consistent in your coding style, consistent in your documenting, consistent in your database naming conventions? Better yet, do you and your team have a coding standard which you consistently adhere to? If you don't, you're buying yourself and others a world of pain - which is painlessly simple to avoid. Today I'm banging the drum, shouting from the street corner, calling from the cathedral spire, imploring you to do one thing, above all else - pick a coding standard and then BE CONSISTENT!

His five reasons for implementing (and effectively using) a coding standard are:

  • Poor, Inconsistent Code - Causes You Pain
  • Your Code is Easier to Read
  • Your Code is Easier to Understand
  • Your Code is Easier to Maintain
  • Your Code is Easier to Collaborate on

Check out the post for summaries of each point.

0 comments voice your opinion now!
coding standard essential opinion maintenance read understand collaborate


NetTuts.com:
PSR-Huh?
January 18, 2013 @ 09:14:59

On NetTuts.com today they've posted a good primer for those that may have heard about the PSR standards that have been introduced to PHP but aren't quire sure what they are (or what they mean to you as a developer).

If you're an avid PHP developer, it's quite likely that you've come across the abbreviation, PSR, which stands for "PHP Standards Recommendation." At the time of this writing, there are four of them: PSR-0 to PSR-3. Let's take a look at what these are, and why you should care (and participate).

They start with a brief history of the standards, the PHP-FIG (Framework Interoperability Group) and where the idea for the PSRs came from. Then the article gets into the details of each:

  • PSR-0: Autoloader Standard
  • PSR-1: Basic Coding Standard
  • PSR-2: Coding Style Guide
  • PSR-3: Logger Interface

They also do a good job mentioning some of the criticism that's come with the standards and what sort of future there is including the creation of a standard for a HTTP messaging package.

0 comments voice your opinion now!
psr standard recommendation coding history future


Richard Rodger:
Why I Have Given Up on Coding Standards
December 05, 2012 @ 13:17:48

In a recent (controversial) post Richard Roger talks about why he's given up on coding standards and includes a few of the reasons that might make you think about your own proceses.

Every developer knows you should have a one, exact, coding standard in your company. Every developer also knows you have to fight to get your rules into the company standard. Every developer secretly despairs when starting a new job, afraid of the crazy coding standard some power-mad architect has dictated. It's better to throw coding standards out and allow free expression. The small win you get from increased conformity does not move the needle. Coding standards are technical ass-covering.

He walks through the evolution of the average developer, the trip from their infancy of "just writing code" to the point of understanding that there needs to be standards to make code easier to read and understand. He includes a list of five "sins of control" that might make coding standards more desirable.

There are worse sins than these. You only need one of them to end up with a coding standard. The truly evil thing about coding standards is what they do to your heart, your team's heart. They are a little message that you are not good enough. You cannot quite be trusted. Without adult supervision, you'll mess up.

As you'd expect, there's plenty of comments on the post, so enjoy reading and maybe contribute some of your own.

0 comments voice your opinion now!
coding standards opinion hurt control freedom


Brian Moon's Blog:
PHP Coding Standards
May 28, 2012 @ 17:12:29

Brian Moon has shared some of his thoughts about the recently proposed standards (PSRs) from the PHP-FIG group based on some discussions had at this year's php|tek.

During the /dev/hell podcast at Tek12, someone asked the guys their opinion about PSR. [...] The person asking the question had asked about PSR1 and PSR2. These are the first two standards proposals in the group and they deal with coding standards. [...] There are already coding standards for PHP and any other language out there. Why does anyone need to make a new one? [...] This reminds me a lot of Open Source licenses. There are tons of these things. And in the end, most (GPL has its issues I know) of the open source licenses represent the same idea.

He goes on to talk more about the feedback he's gotten from other PHP community members about the target of the group and his thoughts on the naming of both the group and the standards they're generating.

In the end, cooperation is good. And if these guys want to cooperate I say more power to them. I just hope they get into really good things soon. Like, can we talk about a maximum number of files, functions or classes used for any one single page execution? *That* would be valuable to the PHP community.
0 comments voice your opinion now!
coding standards psr fig group opinion


PHPMaster.com:
PSR-1 and PSR-2 to be Approved as Standards
May 22, 2012 @ 13:18:40

As is mentioned in this new post to PHPMaster.com, the PHP standards group is officially in the voting process on two new standards (PSR-0 being the first) setting up some standard development practices for PHP applications - PSR-1 and PSR-2.

They initially started out as one proposal but the initial round of voting didn't yield a majority in favor. Participants did however see merit in various requirements the decision was made to split it into 2 proposals - one for mandatory interoperability and one for suggested style.

The PSR-1 standard proposes some basic coding standards (like namespacing structure and class/method naming definitions) and the PSR-2 standard covers similar things, but more in-depth with more recommendations.

If you want to find out how your application stacks up against this new standard, you can try out PHP-CS-Fixer (from Fabien Potencier) to see how many things need an update.

0 comments voice your opinion now!
psr0 psr1 psr2 standard coding convention voting


Sebastian Marek's Blog:
PHP 5.4 Compatibility Coding Standard for PHP_CodeSniffer
March 02, 2012 @ 10:52:32

In the wake of the official release of PHP 5.4 Sebastian Marek has made a quick post to his blog about bringing PHP_CodeSniffer rules help bring his code up to date with this latest version.

So with PHP 5.3 upgrade underway (and PHP 5.4 out of the door now!) I thought it's time to prepare for PHP 5.4 and make sure we're compatible. So by looking at Wim Godden's PHP53Compatibility code sniffs I have created a base for PHP 5.4 sniffs that we want to use to make sure we're compatible.

Sniffs included in set are:

  • PHP54Compatibility_Sniffs_PHP_BreakContinueVarSyntaxSniff
  • PHP54Compatibility_Sniffs_PHP_DeprecatedFunctionsSniff

You can grab this custom set of sniffs either from his github repository or from his personal PEAR channel if you'd rather install it that way (alpha channel).

0 comments voice your opinion now!
phpcodesniffer compatibility coding standard upgrade


Volker Dusch's Blog:
How i judge frameworks - Or Let me code in peace
May 18, 2011 @ 13:45:36

With all of the frameworks making their way around the PHP community, it's interesting to see different developers' takes on judging which is the best for their needs. In this new post to his blog Volker Dusch takes the opposite stance - he hates talking about frameworks.

I just hate talking about frameworks! But as it seems not many people share that feeling so this is an attempt to write a rather short and linkable post on how i approach a new framework and by what standards i judge it. [...] I'm not going to call any names in this post so no need to grab your pitchforks. (For some reason people seem to get really upset when you tell them you don't like the framework the use)

He asks himself a few questions like "can I still write code to my standards" and "how many 'positive adjectives' are used in the description" (inversely related to the quality of the project in his experience). He also talks about one of his other big requirements - being able to actually write unit tests for his code (i.e. the framework must make things testable).

0 comments voice your opinion now!
framework opinion coding standards unittest


Volker Dusch's Blog:
Please ship your own coding standard as part of your project
March 14, 2011 @ 11:32:47

Volker Dusch has a suggestion for all of the PHP projects (or, really Open Source projects in general) that can help keep things cleaner in your codebase and make for simpler times when merging contributions - including your coding standard along with the rest of your project.

Let me elaborate on [an important] point: Contribution. Most developers i know care about producing good code, especially then they are contributing to an open source project! Those people will respect your coding standard, naming scheme and every thing else that they can check for before sending you all patch/pull request. So try to make that part easy.

He talks about doing things the hard way - reformatting everything by hand each time someone contributes - or the easier way of enforcing the coding standard as a part of the contribution flow. He mentions PHP_CodeSniffer and the PHP Mess Detector as a part of a Jenkins installation (easily built from this handy project).

0 comments voice your opinion now!
coding standard phpcodesniffer phpmessdetector jenkins contribution



Community Events





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


application wordpress configure release bugfix code list developer library series interview project framework api threedevsandamaybe podcast community laravel introduction language

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