tag:blogger.com,1999:blog-4172950626830217643.post9074341592224136072..comments2024-03-28T03:20:54.405-04:00Comments on Better Embedded System SW: Embedded System Code Review ChecklistPhil Koopmanhttp://www.blogger.com/profile/11849599272360094243noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-4172950626830217643.post-62301605198315232262020-06-23T22:10:42.097-04:002020-06-23T22:10:42.097-04:00Thanks for the reply. I talked with the Technical ...Thanks for the reply. I talked with the Technical Lead about it, and she said she would help encourage the rules during the reviews, but it has not happened. I suspect that because of business reasons, the focus is just to have a "working software" and not much importance is placed on structural quality. I'll consider the general advice, although I think it is best to find a place where the culture of quality is respected. By the way, I recently found your blog and resources and I think they're exceptional. Thank you for sharing your knowledge and wisdom.Martin Riverohttps://www.blogger.com/profile/17871457950121585713noreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-42355732415083712012020-06-23T21:50:35.273-04:002020-06-23T21:50:35.273-04:00(I can't offer personal advice in this blog, b...(I can't offer personal advice in this blog, but my general advice is always to see if there is a non-threatening way to improve the situation before moving. But without crossing the line that the people there will say bad things about you later.)<br />Phil Koopmanhttps://www.blogger.com/profile/11849599272360094243noreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-68120986437444708252020-06-23T21:49:10.761-04:002020-06-23T21:49:10.761-04:00Martin, I sympathize with your situation. There a...Martin, I sympathize with your situation. There are many reasons this can happen, and it is sometimes more of a cultural issue than ill intent. Did you talk to the technical leader about this in private? (Or if the technical leader is not approachable that is a different kind of issue.) The ways I've seen work in the past all amount to the team members having an experience where they have come to their own conclusion that it is worth doing. Sometimes in a classroom, but more often after having someone find a bug and make the point (the "teachable moment") that this is a bug that was missed in peer review due to poor coding style.Phil Koopmanhttps://www.blogger.com/profile/11849599272360094243noreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-4784845135431849562020-06-23T21:36:43.476-04:002020-06-23T21:36:43.476-04:00If during code reviews, I frequently detect some d...If during code reviews, I frequently detect some developers of my team violating the official coding rules. But they mostly do not care to fix them and the technical leader doesn't make any comment at all; are there ways you recommend to make the team apply the coding rules? Or should I just move to another company where quality is actually respected?Martin Riverohttps://www.blogger.com/profile/17871457950121585713noreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-36110545317397019632020-06-19T08:42:55.853-04:002020-06-19T08:42:55.853-04:00You should most likely be using statecharts instea...You should most likely be using statecharts instead. There is a lecture on statecharts here: https://users.ece.cmu.edu/~koopman/lectures/index.html<br />also, this course builds an entire elevator system using statecharts instead of flowcharts (look at the course project): https://users.ece.cmu.edu/~koopman/ece649/Phil Koopmanhttps://www.blogger.com/profile/11849599272360094243noreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-11805735364070480912020-06-19T06:50:20.307-04:002020-06-19T06:50:20.307-04:00 A-7. Are there any if/else structures nested mor... A-7. Are there any if/else structures nested more than two deep? (consecutive “else if” is OK)<br /> A-8. Are there nested switch or case statements? (they should never be nested)<br />What is the solution for that? My project have many conditions which must tested before take an action <br />Foe example my project is elevator control card " when the elevator car requested many safety inputs must tested and direction of car moving and many others before i give the motor the run decision "<br />Thanks <br />mohamed megahedhttps://www.blogger.com/profile/07676055334315006235noreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-50859786481299960702016-04-30T18:38:11.052-04:002016-04-30T18:38:11.052-04:00Hmm, well, that is only one explanation. The very...Hmm, well, that is only one explanation. The very next reply in that same stackexchange posting explains that funneling everything to the same return-from point makes it easier to clean up loose ends, which is more along the lines of why I make this recommendation. Additionally, in code with returns all over the place it is often the case that the code is unstructured in general (if it were structured, you wouldn't need all the returns). If you are a relative beginner I highly recommend this rule despite what you say. If you are advanced then well you aren't going to follow this advice, but don't forget that beginners are often the folks how are going to have to maintain your code later.<br /><br />Next time instead of saying something is BS perhaps instead explain why you think it is misguided in more specific terms, and acknowledge others who might have contrary opinions (and, ideally, why you think they are misguided).Phil Koopmanhttps://www.blogger.com/profile/11849599272360094243noreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-9686728189144929582016-04-30T18:32:22.809-04:002016-04-30T18:32:22.809-04:00Most embedded compilers have terribly weak warning...Most embedded compilers have terribly weak warnings. If you are 100% sure your compiler will warn you about all possible uninitialized variables, and that you will actually pay attention to the warning, then it's OK to tailor the list to remove this point. I have seen WAY too many embedded systems where the compiler didn't have the warning, didn't initialize, and sure enough there was a bug there. Phil Koopmanhttps://www.blogger.com/profile/11849599272360094243noreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-702522708929702382016-04-27T17:27:40.811-04:002016-04-27T17:27:40.811-04:00F-8. Are all variables initialized before use?
No...F-8. Are all variables initialized before use?<br /><br />Not applied everywhere, consider this:<br /><br />bool res = false;<br />...<br />res = Foo();<br /><br />Keil will give a warning "Dead Assignment Eliminated"Anonymoushttps://www.blogger.com/profile/06820866248005088826noreply@blogger.comtag:blogger.com,1999:blog-4172950626830217643.post-64903695818255839502016-04-27T17:21:40.324-04:002016-04-27T17:21:40.324-04:00F-7. Can this function be written with a single po...F-7. Can this function be written with a single point of exit? (no returns in middle of function)<br /><br />Rule is a BS!<br />The best explanation every about the history of that anachronism:<br />http://programmers.stackexchange.com/a/118793Anonymoushttps://www.blogger.com/profile/06820866248005088826noreply@blogger.com