<pedrocorreia.net ⁄>

<How Important is Coding Style, and How Do You Enforce It? ⁄ >

clicks: 3968 3968 2007-01-31 2007-01-31 goto tecnologia myNews tecnologia  Bookmark This Bookmark This

It may be so, but few things can irk a good developer as deeply as encountering code that's inconsistent in its coding style. Most projects, indeed, define coding standards, and the Java language itself has an officially blessed style guide. For those who dream in code, especially, poor coding style means nightmare.

Some developers may argue that automated tools make it less important for developers to focus on following any particular coding style. IDEs, for instance, allow project-wide code style settings, and can even reformat code to adhere to a particular standard. Other tools, such as CheckStyle-which today released its new 4.3 version- can flag potential style problems in an existing code base.

While IDEs and style checking tools do an overall excellent job helping developers adhere to coding standards, I find especially IDE-based auto-reformatting less than practical: When auto-reformatting entire classes, the newly-formatted source files cause the source control system to indicate lots of code changes, even though those changes were only in formatting. The newly formatted version is really the same version as the previous one, unless we consider code reformatting a form of refactoring. Otherwise, ensuring consistency in coding style forces us to forfeit consistency in versioning (having a new version number indicate a changed source file).

In practice, I think that auto-reformatting code once in a while may be fine, but can cause confusion if used more often, especially on a package and project level. As a result, the automated tools notwithstanding, developers still need to carefully follow a project's coding style.

But what if they don't? I have certainly seen code written by fairly well-known developers that wouldn't pass a strict code-style check. In other words, excellent code, but with somewhat inconsistent style. At Artima, we have already integrated CheckStyle into our build process as a task we can run at our leisure to find style inconsistencies. But a clean bill of code style health is not currently a requirement for checking in code. We are thinking of a deeper integration, and I wonder to what extent others have required style checking as a condition of allowing commits, for instance.

este é só um excerto do artigo, para aceder ao artigo completo, clique no link em baixo:
this is just a small excerpt from the article, to access the full article please click in the link below:


Subscribe News RSS  Subscribe News Updates by E-mail

myNews <myNews show="rand" cat="tecnologia" ⁄>

MongoDb Architecture new ...

NOSQL has become a very heated topic for large web-scale deployment where scalability and semi-struc (...)

clicks: 22197 22197 2012-05-14 2012-05-14 goto url (new window) horicky.blogspo... goto myNews tecnologia

A Hopefully Fair and Useful Comparison of Haskell Web Frameworks new ...

Recently there has been a lot of discussion and questions about the differences between the big thre (...)

clicks: 27415 27415 2012-05-13 2012-05-13 goto url (new window) softwaresimply.... goto myNews tecnologia

Retina graphics for your website new ...

retina.js is an open source script that makes it easy to serve high-resolution images to devices wit (...)

clicks: 17625 17625 2012-05-11 2012-05-11 goto url (new window) retinajs.com/ goto myNews tecnologia

What every programmer should know about memory, Part 1 new ...

In the early days computers were much simpler. The various components of a system, such as the CPU, (...)

clicks: 21524 21524 2012-05-10 2012-05-10 goto url (new window) lwn.net/Article... goto myNews tecnologia

The State Of HTML5 Video

HTML5 has entered the online video market, which is both exciting and challenging for developers in (...)

clicks: 8374 8374 2012-02-14 2012-02-14 goto url (new window) longtailvideo.c... goto myNews tecnologia

A Tour of Amazon's DynamoDB

Amazon's recent release of DynamoDB, a database whose name is inspired by Dynamo, the key-value data (...)

clicks: 7767 7767 2012-02-13 2012-02-13 goto url (new window) paperplanes.de/... goto myNews tecnologia

Video: CSS3 Secrets: 10 things you might not know about CSS3

A number of prominent front-end developers delivered helpful talks at this year's Fronteers 2011 con (...)

clicks: 8473 8473 2011-11-30 2011-11-30 goto url (new window) css.dzone.com/a... goto myNews tecnologia

Google BigQuery Service: Big data analytics at Google speed

Rapidly crunching terabytes of big data can lead to better business decisions, but this has traditio (...)

clicks: 7765 7765 2011-11-30 2011-11-30 goto url (new window) googlecode.blog... goto myNews tecnologia