bookmate game
Robert Martin

The Robert C. Martin Clean Code Collection (Collection)

Notify me when the book’s added
To read this book, upload an EPUB or FB2 file to Bookmate. How do I upload a book?
  • b4777467766has quoted4 days ago
    Remember that the people who read your code will be programmers. So go ahead and use computer science (CS) terms, algorithm names, pattern names, math terms, and so forth. It is not wise to draw every name from the problem domain because we don’t want our coworkers to have to run back and forth to the customer asking what every name means when they already know the concept by a different name.
  • b4777467766has quoted4 days ago
    When there is no “programmer-eese” for what you’re doing, use the name from the problem domain. At least the programmer who maintains your code can ask a domain expert what it means.
  • b4777467766has quoted4 days ago
    In an imaginary application called “Gas Station Deluxe,” it is a bad idea to prefix every class with GSD. Frankly, you are working against your tools. You type G and press the completion key and are rewarded with a mile-long list of every class in the system.
  • b4777467766has quoted4 days ago
    Modern editing environments like Eclipse and IntelliJ-provide context-sensitive clues, such as the list of methods you can call on a given object. But note that the list doesn’t usually give you the comments you wrote around your function names and parameter lists. You are lucky if it gives the parameter names from function declarations. The function names have to stand alone, and they have to be consistent in order for you to pick the correct method without any additional exploration.
  • b4777467766has quoted4 days ago
    say we have many classes where add will create a new value by adding or concatenating two existing values. Now let’s say we are writing a new class that has a method that puts its single parameter into a collection. Should we call this method add? It might seem consistent because we have so many other add methods, but in this case, the semantics are different, so we should use a name like insert or append instead.
  • b4777467766has quoted4 days ago
    When constructors are overloaded, use static factory methods with names that describe the arguments. For example,

    Complex fulcrumPoint = Complex.FromRealNumber(23.0);

    is generally better than

    Complex fulcrumPoint = new Complex(23.0);
  • b4777467766has quoted4 days ago
    Pick one word for one abstract concept and stick with it. For instance, it’s confusing to have fetch, retrieve, and get as equivalent methods of different classes. How do you remember which method name goes with which class? Sadly, you often have to remember which company, group, or individual wrote the library or class in order to remember which term was used.
  • b4777467766has quoted4 days ago
    Readers shouldn’t have to mentally translate your names into other names they already know.
  • b4777467766has quoted4 days ago
    In general programmers are pretty smart people. Smart people sometimes like to show off their smarts by demonstrating their mental juggling abilities. After all, if you can reliably remember that r is the lower-cased version of the url with the host and scheme removed, then you must clearly be very smart.
  • b4777467766has quoted4 days ago
    people quickly learn to ignore the prefix (or suffix) to see the meaningful part of the name. The more we read the code, the less we see the prefixes. Eventually the prefixes become unseen clutter and a marker of older code.
fb2epub
Drag & drop your files (not more than 5 at once)