Login
Правильно программировать
NEW 29.11.05 14:36
in Antwort Tomasson 28.11.05 22:25
NEW 29.11.05 15:07
in Antwort Simple 29.11.05 14:36
Some time ago I look for code which was a winner of "Creazy Code" world championship.
A code print out an Article (or Poem)... xmmm... several pages...
But(!) nobody can understand - how. Programm code was 25-30 times shortest that poem.

A code print out an Article (or Poem)... xmmm... several pages...

But(!) nobody can understand - how. Programm code was 25-30 times shortest that poem.

NEW 29.11.05 15:07
in Antwort Simple 29.11.05 14:36
Fowler, "Refactoring"
В ответ на:
Don't worry, we aren't saying that people shouldn't write comments. In our olfactory analogy, comments aren't a bad smell; indeed they are a sweet smell. The reason we mention comments here is that comments often are used as a deodorant. It's surprising how often you look at thickly commented code and notice that the comments are there because the code is bad. Comments lead us to bad code that has all the rotten whiffs we've discussed in the rest of this chapter. Our first action is to remove the bad smells by refactoring. When we're finished, we often find that the comments are superfluous.
If you need a comment to explain what a block of code does, try Extract Method. If the method is already extracted but you still need a comment to explain what it does, use Rename Method. If you need to state some rules about the required state of the system, use Introduce Assertion.
When you feel the need to write a comment, first try to refactor the code so that any comment becomes superfluous. A good time to use a comment is when you don't know what to do. In addition to describing what is going on, comments can indicate areas in which you aren't sure. A comment is a good place to say why you did something. This kind of information helps future modifiers, especially forgetful ones.
Don't worry, we aren't saying that people shouldn't write comments. In our olfactory analogy, comments aren't a bad smell; indeed they are a sweet smell. The reason we mention comments here is that comments often are used as a deodorant. It's surprising how often you look at thickly commented code and notice that the comments are there because the code is bad. Comments lead us to bad code that has all the rotten whiffs we've discussed in the rest of this chapter. Our first action is to remove the bad smells by refactoring. When we're finished, we often find that the comments are superfluous.
If you need a comment to explain what a block of code does, try Extract Method. If the method is already extracted but you still need a comment to explain what it does, use Rename Method. If you need to state some rules about the required state of the system, use Introduce Assertion.
When you feel the need to write a comment, first try to refactor the code so that any comment becomes superfluous. A good time to use a comment is when you don't know what to do. In addition to describing what is going on, comments can indicate areas in which you aren't sure. A comment is a good place to say why you did something. This kind of information helps future modifiers, especially forgetful ones.
I did it
my way.
NEW 29.11.05 15:34
in Antwort Murr 29.11.05 15:07
Ты мне лучше растолкуй, о чем тут поется: http://www.seeklyrics.com/lyrics/David-Bowie/The-Bewlay-Brothers.html ;-)
NEW 29.11.05 15:48
in Antwort scorpi_ 29.11.05 15:12
Yes, about code production and code quality.
I give a sample of code, which do somthing and do very good, but which is completely nonunderstandible.
Of course such type of code cann't be maded with another way, but this sample show that Comment for a code is a god option and have to be added to code.
I give a sample of code, which do somthing and do very good, but which is completely nonunderstandible.

Of course such type of code cann't be maded with another way, but this sample show that Comment for a code is a god option and have to be added to code.

NEW 29.11.05 15:51
in Antwort Simple 29.11.05 15:31
NEW 29.11.05 22:46
in Antwort Simple 29.11.05 14:36
гы...код почти как у меня... 
так ради интереса, а что он делает??
поменял в проге то что просили...захотелось ещё кое-чё улучшить..но запутался в конец..
болъше так не буду писать...каждая строчка..отдельный комент..

так ради интереса, а что он делает??
поменял в проге то что просили...захотелось ещё кое-чё улучшить..но запутался в конец..
болъше так не буду писать...каждая строчка..отдельный комент..
NEW 29.11.05 22:59
in Antwort Quo Vadis 29.11.05 22:46
NEW 29.11.05 23:42
in Antwort Quo Vadis 29.11.05 22:46
Построчный комент - писать почти без толку.
Бо, максимум, что ты там напишешь - тоже самое что и в операторе.
Писать надо большую шапку для каждого модуля/класса и каждой функции/метода.
Описывать настолько полно, чтобы писать код мог другой человек. Тогда - есть
смысл все это делать. А коммент типа - здесь мы к А прибавим Б чтобы получить Ц
Нафиг никому не нужен. Через неделю он не нужен будет и тебе...
Бо, максимум, что ты там напишешь - тоже самое что и в операторе.
Писать надо большую шапку для каждого модуля/класса и каждой функции/метода.
Описывать настолько полно, чтобы писать код мог другой человек. Тогда - есть
смысл все это делать. А коммент типа - здесь мы к А прибавим Б чтобы получить Ц
Нафиг никому не нужен. Через неделю он не нужен будет и тебе...
