bookmate game
en
Robert Martin

The Robert C. Martin Clean Code Collection (Collection)

Obavijesti me kada knjiga bude uvrštena
Da biste čitali ovu knjigu u Bookmate učitajte datoteku EPUB ili FB2. Kako mogu učitati knjigu?
  • b4777467766je citiralaprekjučer
    Notice that the generatePrimes function is divided into sections such as declarations, initializations, and sieve. This is an obvious symptom of doing more than one thing. Functions that do one thing cannot be reasonably divided into sections.
  • b4777467766je citiralaprekjučer
    So, another way to know that a function is doing more than “one thing” is if you can extract another function from it with a name that is not merely a restatement of its implementation [G34].
  • b4777467766je citiralaprije 6 dana
    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.
  • b4777467766je citiralaprije 6 dana
    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.
  • b4777467766je citiralaprije 6 dana
    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.
  • b4777467766je citiralaprije 6 dana
    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.
  • b4777467766je citiralaprije 6 dana
    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.
  • b4777467766je citiralaprije 6 dana
    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);
  • b4777467766je citiralaprije 6 dana
    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.
  • b4777467766je citiralaprije 6 dana
    Readers shouldn’t have to mentally translate your names into other names they already know.
fb2epub
Povucite i ispustite datoteke (ne više od 5 odjednom)