??? 07/17/09 15:33 Read: times |
#167500 - Do document Responding to: ???'s previous message |
You are wrong if you make it so simple as believing that variable names and function names will remove the need for comments.
Just having a variable col and a variable COL should be enough to make it a bit confusing reading the code, don't you think? If you do document your code, you would realize that there are many corner cases your code does not handle. Your variable names will not document the reason why your code does not handle a key release before your scanning is through with the full scan. Your variable names will not document what you expect to show if no key is pressed. Your variable names will not document what is expected to show if more than one key is pressed at the same time. Your variable names will not document what happens if the "unused" four pins of the two ports are used for. Must they always be driven to low? May they be held high? What happens if something externally draws a pin low? What happens with the assignment "COL = (temp <<= 1)" if temp is already 0x08? Right now, you have code that locks up indefinitely while waiting for a key to be pressed. This means that the code can't be used for a real product. This isn't documented. Your variable names will not be able to document any assumptions you have made. |
Topic | Author | Date |
Keypad interface problem: My code not working.. | 01/01/70 00:00 | |
Check in a simulator | 01/01/70 00:00 | |
RE: | 01/01/70 00:00 | |
Care for details | 01/01/70 00:00 | |
Formatted code | 01/01/70 00:00 | |
RE: i dint check the bounce | 01/01/70 00:00 | |
Bounce vital to think about | 01/01/70 00:00 | |
Do document | 01/01/70 00:00 | |
re: documentation prob | 01/01/70 00:00 | |
Fixing prob: | 01/01/70 00:00 | |
Did you search? | 01/01/70 00:00 | |
RE: the search tool here is not the most powerful | 01/01/70 00:00 | |
Karas's Keypad Scanner Code In C - detabbed | 01/01/70 00:00 | |
Properly documented code | 01/01/70 00:00 | |
Reasons and assumptions | 01/01/70 00:00 | |
Per, you implied, but did not say | 01/01/70 00:00 | |
dangerous loops | 01/01/70 00:00 | |
code??? | 01/01/70 00:00 | |
RE: now am modified my code | 01/01/70 00:00 | |
How to post legible source code | 01/01/70 00:00 | |
unfortunately, that does not add comments | 01/01/70 00:00 | |
re: thanks now i got how to insert code | 01/01/70 00:00 | |
Scanning Keypad | 01/01/70 00:00 | |
How to scan Keypad![]() | 01/01/70 00:00 |