??? 09/18/06 15:14 Read: times |
#124478 - Logic or Algorithm |
I was reading a microcontroller assembler book the other day where the author gave an example of scanning a keyboard a key at a time. The code was a huge list of bit test and branch instructions followed by an appropriate bit set instruction to light LEDs to show the key pressed. It got me thinking about a book I read many years ago on Forth, which talked about the logic and algorithm approaches to solving programming prblems. The author's point was that many problems which are normaly solved by logic (if then else type of constructs) are often better solved (smaller & faster) by recognising that an algorithm can be used. Using the original example of the keyboard scanning, I could see there was a very simple relationship between the state of the key input port and the desired LED outputs. Code size was about one tenth and speed constant irrespective of which key is pressed using this algorithm.
The point I want to make is that many software books talk almost exclusively about logic but rarely is the algorithmic approach given much if any space. Ian |
Topic | Author | Date |
Logic or Algorithm | 01/01/70 00:00 | |
So what was your "Algorithm"? | 01/01/70 00:00 | |
back to Hurley | 01/01/70 00:00 | |
Programming 101 | 01/01/70 00:00 | |
sometimes it's not bad to remember history | 01/01/70 00:00 | |
My Algorithm | 01/01/70 00:00 | |
Lost | 01/01/70 00:00 | |
Think think think ..... | 01/01/70 00:00 | |
Hurley again | 01/01/70 00:00 | |
well only today | 01/01/70 00:00 | |
Is there a difference? | 01/01/70 00:00 | |
Terminology - Ian? | 01/01/70 00:00 | |
Calculation vs Data Structures vs Logic | 01/01/70 00:00 |