DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. Languages
  4. Poll Results: Which 'Elements of Programming Style' Are Totally Wrong? [125 responses]

Poll Results: Which 'Elements of Programming Style' Are Totally Wrong? [125 responses]

Don't let anyone tell you there's nothing new under the programming sun. Sometimes even Brian Kernighan overdoes it. More insights to follow...

John Esposito user avatar by
John Esposito
·
Aug. 31, 16 · Analysis
Like (8)
Save
Tweet
Share
6.22K Views

Join the DZone community and get the full member experience.

Join For Free

Last week we asked what you thought of Kernighan and Plauger's classic Elements of Programming Style. 125 responded, which doesn't strongly represent the whole world's developer population (if the sample were totally randomly selected from all developers in the world (which it isn't), and if the one-question poll had only two answer options, then at a 95% confidence level the confidence interval would be a pretty big 9), but results are worth examining at least to understand our own community better.

Full results are embedded below and accessible here. Three points worth calling out at first pass:

  1. Most {strongly|null} disagreed-with principle (45%): Write first in easy-to-understand pseudo language; then translate into whatever language you have to use. Maybe K&P proposed this in (pre-OO) 1974 because procedural code makes higher-level understanding difficult. Also unclear whether respondents took 'pseudo language' to include non-source symbol systems like UML (which also serve the 'get it before implementing it' goal) or just code read linearly by compiler/interpreter -- but guessing the 'pseudo' sounded enough like 'pseudo-code' not to mean boxes and arrows. 

  2. Interesting 'most {strongly|null} disagreed-with' runner-up: Avoid too many temporary variables (22%). True, this is worse for DMA languages (rollin' a little calloc(), oops forgot to  free()) and less worrisome for memory-managed (we Java lovers might call them "high productivity") languages. Still can be readability issue (cognitive mismatch between human brain whose working memory doesn't exactly use named temp variables).

  3. The top ten most {strongly|null} agreed-with principles, except one (the DRY one), are all about human readability and maintainability, not algorithmic efficiency and not even very specific to computation (Say what you mean, simply and directly./Choose variable names that won't be confused./Replace repetitive expressions by calls to common functions./If a logical expression is hard to understand, try transforming it./Write and test a big program in small pieces./Modularize. Use procedures and functions./Write clearly -- don't be too clever./Make it right before you make it faster./Use variable names that mean something.).

Will keep digging and let you know what else we find. Anything about these answers immediately strike you?



Element dev Efficiency (statistics) Memory (storage engine) UML Testing Pass (software)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Bye Bye, Regular Dev [Comic]
  • How to Create a Real-Time Scalable Streaming App Using Apache NiFi, Apache Pulsar, and Apache Flink SQL
  • Better Performance and Security by Monitoring Logs, Metrics, and More
  • Differences Between Site Reliability Engineer vs. Software Engineer vs. Cloud Engineer vs. DevOps Engineer

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: