Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Write BETTER Code! 7 Tips to Write Meaningful Names for variables, functions, classes

  • notJust․dev
  • 2020-07-14
  • 3153
Write BETTER Code! 7 Tips to Write Meaningful Names for variables, functions, classes
clean codeprogrammingcodingsoftware engineeringsoftware developerlearn programmingprogramming for beginnersvadim savinfiteniumcoding tutorialtutorialjavascriptjavaweb developmentmobile developmentfront endback endclean code bookvariable namehow to name variableshow to name classesrobert martinuncle bobrefactoringcode smellquality codelearn javascriptcoding techstartupsjomamayokotech leadclément mihailescuhow to code
  • ok logo

Скачать Write BETTER Code! 7 Tips to Write Meaningful Names for variables, functions, classes бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Write BETTER Code! 7 Tips to Write Meaningful Names for variables, functions, classes или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Write BETTER Code! 7 Tips to Write Meaningful Names for variables, functions, classes бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Write BETTER Code! 7 Tips to Write Meaningful Names for variables, functions, classes

I want to share with you some tips and tricks on how to write cleaner code that will be easier to maintain in the future. This series will be based on the Clean Code book (https://amzn.to/3fv01rt)

Today we are going to speak about meaningful names so watch this video till the end and you will learn how to tell the difference between good code and bad code. You’ll know how to write good and meaningful names. And you’ll know how to transform bad names into good ones.

Names are everywhere in software. We name our variables, our functions, our arguments, classes, and packages. Because we do so much of it, we’d better do it well and in this case, don't be like Elon Musk.

1. Use Intention-revealing names
The name of a variable, function, or class, should answer all the big questions. It should tell you why it exists, what it does, and how it is used. If a name requires a comment, then the name does not reveal its intent.

2. Use pronounceable names
Humans are good at words. So make your names pronounceable. If you can’t pronounce it, you can’t discuss it without sounding like an idiot.

3. Use Searchable names
Single-letter names and numeric constants have a particular problem in that they are not easy to locate across a body of text. One might easily grep for MAX_CLASSES_PER_STUDENT, but the number 7 could be more
troublesome. My personal preference is that single-letter names can ONLY be used as local variables inside short methods. The length of a name should correspond to the size of its scope

4. Avoid Mental mapping
Readers shouldn’t have to mentally translate your names into other names they already know. This is a problem with single-letter variable names. Certainly, a loop counter may be named i or j or k if its scope is very small and no other names can conflict with it. This is because those single-letter names for loop counters are traditional. However, in most other contexts a single-letter name is a poor choice; it’s just a place holder that the reader must mentally map to the actual concept.

5. Class names
Classes and objects should have noun or noun phrase names like Customer, WikiPage, Account, and AddressParser. Avoid words like Manager, Processor, Data, or Info in the name of a class. Also, A class name should not be a verb.

6. Method names
Methods should have verb or verb phrase names like postPayment, deletePage, or save. Accessors, mutators, and predicates should be named for their value and prefixed with get, set, and is. For example getAge, setAge, isTeenager

7. Pick one-word per concept
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? you spend an awful lot of time browsing through headers and
previous code samples. A consistent lexicon is a great boon to the programmers who must use your code.

The hardest thing about choosing good names is that it requires good descriptive skills and a shared cultural background. This is a teaching issue rather than a technical, business, or management issue.
Don't be afraid to rename things because Most of the time we don’t really memorize the names of classes and methods. We use the modern tools to deal with details like that so we can focus on whether the code reads like paragraphs and sentences. You will probably end up surprising someone when you rename, just like you might with any other code improvement.
Follow some of these rules and see whether you don’t improve the readability of your code. If you are maintaining someone else’s code, use refactoring tools to help resolve these problems. It will pay off in the short term and continue to pay in the long run.

#cleancode #programming #coding

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]