tag:blogger.com,1999:blog-4172950626830217643.post2516490309815617921..comments2024-03-28T03:20:54.405-04:00Comments on Better Embedded System SW: Not Getting Software WrongPhil Koopmanhttp://www.blogger.com/profile/11849599272360094243noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-4172950626830217643.post-44142712708928469162015-03-01T08:53:37.021-05:002015-03-01T08:53:37.021-05:00Also you have turned off the motors in a sequence ...Also you have turned off the motors in a sequence that is controlled. The robot could rotate if you turned off the motors on one side first.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-58469975463412705432015-01-31T04:46:48.159-05:002015-01-31T04:46:48.159-05:00There is a fundamental issue at stake here: If the...There is a fundamental issue at stake here: If the program is parameterised in some way (in this case, number of wheels is flexible and the limits are defined in some common central place eg "limits.h"), then iteration is the only way to go.<br /><br />On the other hand if the program is tightly bound to its hardware, and there is no chance ever of that changing (or more correctly, if a hardware change would have a non-trivial effect on the firmware, such that a major inspection and update would be required anyhow) then it is far better to go for clarity and simplicity.<br /><br />My rule of thumb is based on the above, and moderated by a 2nd unofficial rule that I use: Go for Clarity over Clever. I do this because I'm selfish - it's often me that comes back months or years later to look at my code - and I don't want to try and figure out how it works (that takes time and effort). I want it to be so OBVIOUS how it works that it's like being belted by a wet fish. That way I can figure it out fast with the smallest amount of brain power.ashleighhttps://www.blogger.com/profile/03109431499306884717noreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-6378421966403943642014-12-12T15:43:26.960-05:002014-12-12T15:43:26.960-05:00Great post, can't agree more!Great post, can't agree more!ldobsiknoreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-35098650932746312292014-11-20T09:36:38.580-05:002014-11-20T09:36:38.580-05:00Phil - nice use of the Hoare quote, that is one of...Phil - nice use of the Hoare quote, that is one of my favorites. I'd like to add a couple more that are "apropos":<br /><br />Brian Kernighan (from his book, "The Elements of Programming Style"): " Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it?<br /><br />Kathy Sierra and Bert Bates: "Code as if the next person to maintain your code is a homicidal maniac who knows where you live". (from their book "Sun Certified Programmer & Developer for Java 2 Study Guide")<br />Danhttp://www.barrgroup.comnoreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-45434502790653150782014-11-17T15:37:39.417-05:002014-11-17T15:37:39.417-05:00Also, in the first example, you assume that you in...Also, in the first example, you assume that you index the wheels by a number, which can miss some type-checking errors. In the second approach, this is possible to use an enumeration to identify the wheels, which can then add additional compile-time checks ...Anonymousnoreply@blogger.com