Smalltalk в примерах/Методы: различия между версиями
Содержимое удалено Содержимое добавлено
Curshunji (обсуждение | вклад) |
|||
Строка 43:
-->
Имена методов должны говорить о том что метод делает. Не экономьте буквы; более важна ясность имени чем его длинна. Программист должен быть способен посмотрев на код немедленно сказать что он делает, просто прочитав имя. Однако, не всегда просто подобрать хорошее имя, когда
<!--
Method names should say exactly what the method does. Don't be stingy with the number of characters; it's more important to be understandable than short. A programmer should be able to pick up someone else's code and immediately know what the method does, just be reading the name. However, it's not always easy to come up with a great method name when you are looking at the method itself. It's when the method is being invoked, when you are doing the message send, that you'll get the best idea of how good the name is. If it makes sense in the context where it is sent, then you've probably got a good name. So, while it's okay to name the method when you are writing it, be prepared to go back and change the name after you use it in other methods.
|