Get The Art of Readable Code PDF

By Dustin Boswell, Trevor Foucher

As programmers, we’ve all visible resource code that’s so gruesome and buggy it makes our mind discomfort. over the last 5 years, authors Dustin Boswell and Trevor Foucher have analyzed hundreds of thousands of examples of "bad code" (much of it their very own) to figure out why they’re undesirable and the way they can be more desirable. Their end? you must write code that minimizes the time it can take another person to appreciate it—even if that somebody else is you.

This e-book specializes in easy ideas and functional strategies you could practice each time you write code. utilizing easy-to-digest code examples from diversified languages, each one bankruptcy dives right into a various element of coding, and demonstrates how one can make your code effortless to understand.

Simplify naming, commenting, and formatting with counsel that follow to each line of code
Refine your program’s loops, common sense, and variables to lessen complexity and confusion
Attack difficulties on the functionality point, equivalent to reorganizing blocks of code to do one activity at a time
Write powerful try code that's thorough and concise—as good as readable
"Being conscious of how the code you create impacts those that examine it later is a crucial a part of constructing software program. The authors did a good task in taking you thru the several facets of this problem, explaining the main points with instructive examples."
—Michael starvation, passionate software program Developer

Staff word: Checked - Retail-Quality PDF

Show description

Read Online or Download The Art of Readable Code PDF

Similar programming books

Download e-book for kindle: The Art of Readable Code by Dustin Boswell, Trevor Foucher

As programmers, we’ve all visible resource code that’s so gruesome and buggy it makes our mind pain. during the last 5 years, authors Dustin Boswell and Trevor Foucher have analyzed 1000s of examples of "bad code" (much of it their very own) to figure out why they’re undesirable and the way they can be greater.

Emphasizing Parallel Programming Techniques - download pdf or read online

On account that its first quantity in 1960, Advances in pcs has awarded specific assurance of suggestions in and software program and in laptop thought, layout, and functions. It has additionally supplied contributorswith a medium during which they could study their topics in larger intensity and breadth than that allowed by way of usual magazine articles.

Robert J Vanderbei's Linear Programming: Foundations and Extensions, 3rd Edition PDF

This 3rd variation introduces the most recent conception and functions in optimization. It emphasizes restricted optimization, starting with linear programming after which continuing to convex research, community flows, integer programming, quadratic programming, and convex optimization. You’ll find a host of useful company purposes in addition to non-business functions.

Additional info for The Art of Readable Code

Example text

If code mentions A, B, and C in one place, don’t say B, C, and A in another. Pick a meaningful order and stick with it. ” AESTHETICS 43 CHAPTER FIVE Knowing What to Comment 45 The goal of this chapter is to help you realize what you should be commenting. You might think the purpose of commenting is to “explain what the code does,” but that is just a small part of it. KEY IDEA The purpose of commenting is to help the reader know as much as the writer did. When you’re writing code, you have a lot of valuable information in your head.

For example, a function named SpaceLeft() sounds like it might return a number. If it were meant to return a boolean, a better name would be HasSpaceLeft(). Finally, it’s best to avoid negated terms in a name. For example, instead of: bool disable_ssl = false; it would be easier to read (and more compact) to say: bool use_ssl = true; Matching Expectations of Users Some names are misleading because the user has a preconceived idea of what the name means, even though you mean something else. In these cases, it’s best to just “give in” and change the name so that it’s not misleading.

Whatever the order, you should use the same order throughout your code. location = = = = = details phone email url location # Hey, where did 'location' go? # Why is 'location' down here now? Organize Declarations into Blocks The brain naturally thinks in terms of groups and hierarchies, so you can help a reader quickly digest your code by organizing it that way. For example, here’s a C++ class for a frontend server, with all its method declarations: class FrontendServer { public: FrontendServer(); void ViewProfile(HttpRequest* request); void OpenDatabase(string location, string user); void SaveProfile(HttpRequest* request); string ExtractQueryParam(HttpRequest* request, string param); void ReplyOK(HttpRequest* request, string html); void FindFriends(HttpRequest* request); void ReplyNotFound(HttpRequest* request, string error); void CloseDatabase(string location); ~FrontendServer(); }; This code isn’t horrible, but the layout certainly doesn’t help the reader digest all those methods.

Download PDF sample

The Art of Readable Code by Dustin Boswell, Trevor Foucher


by Brian
4.4

Rated 4.74 of 5 – based on 36 votes