Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programming Style
Message
From
03/07/2002 14:09:12
Stan Vaninger
Mitek Industries, Inc
Missouri, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Programming Style
Miscellaneous
Thread ID:
00675045
Message ID:
00675045
Views:
51
I just read an excellent article on programming style that others may find helpful: "Enlightened Java Style" by Jeff Langr, in the March 2002 issue of Software Development. While written with the Java developer in mind, these XP (Extreme Programming) principles can be applied to any language. The author advocates a style of programming that can be expressed in three simple principles:
1) Composed Method
2) Intention-Revealing Name
3) Comment

Here are a few of the high points of the article:

"Composed Method states that a method should do things at one level of abstraction. It should be highly cohesive. It should do one thing and do it well."

Yeah, yeah. We've heard that before. But there's more.

"Rapid understanding is most important here - it should take me no more than a minute or two to understand what a developer intended the method to do."

"The first key to good naming is thinking in terms of encapsulation. When I name a variable or method, the name never suggests how it is implemented; rather, it indicates what it is or what it is used for."

"Intention-Revealing Name and Composed Method go hand in hand. The smaller a method is and the less it does, the easier it is to come up with a succinct Intention-Revealing Name."

This next one was a shocker for me:

"Strive to eliminate comments in your code."

But Jeff give ample justification for what seems like an outrageous statement:

"Comments indicate that code is not communicating clearly. As others have said, 'Comments are lies.' . . . If I have to explain a method, it's not simple enough."

"Mehods should be a dozen lines or less. Scrolling is bad. . . . Code that forces scrolling might work fine for the fortunate few with photographic memory, but for the rest of us, it is a taxing exercise."
Next
Reply
Map
View

Click here to load this message in the networking platform