Best Practices to Manage Complexity in Hardward/Software Design?

Jul 21, 2005 127 Replies

I agree with that.

I don't necessarily agree with that (the "must" part). It depends on where the complexity / newness / risk is. If the newness is in the "glue" binding the smallest peices together, then it's sometimes possible to emulate/simulate the smallest posces pissible (as typed) and concentrate on getting the glue right.

I think this is just one valid approach (bottom-up implementation). It's not the only valid one.

Where an existing product-line is being replaced with the newly designed product, it's possible to use the existing, working product as "the complete system" and replace components of it as those components get re-designed and re-implemented.

In software, you can start off implementation at a high-level of abstraction and just "stub-out" the detail until you're ready to deal with it. When I start implementing software, I don't (necessarily) start implementing a function... I first figure out what modules / classes / components need to be there and instantiate them. Then I figure out what external interfaces those classes need to present to each other. Etc. etc.

Ciao,

Peter K.

Whatever works for you is good. Writing stubs may be worth the effort, bur not writing stubs is less effort.

I try to start with interfaces and data structures, and to write small testable pieces that instantiate or use them. Every piece incorporated into a larger structure has already been vetted, and unless I've made a false start, nothing is discarded.

Jerry

Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Is there any other reason besides "to support unit testing" to implement from the bottom up? I was wondering if the people that have problems with TDD might be the people that are used to implementing form the top down.

I have always coded from the top down. I make a user interface, then start figuring out how what is needed to support the user interface. I add stub classes with comments like "UNDONE" or "TODO". When I can search my entire project and I don't find any of these comments, then I'm done. Of course this method has made adopting TDD very diffucult for me.

Does anyone else prefer top down to bottom up development? and has that hindered your adoption of TDD?

Do you find that this impairs your ability to apply unit tests, specifically as TDD?

-Scott Frye

Yep. Top down design often produces a module split which looks great at first sight, but doesn't play out too well in practice. It might be clumsy to implement, or it might produce inefficient results. Also top down often produces a split which doesn't match well with existing code, and inhibits reuse of that code. Implementing bottom up makes you aware of these issues at an early stage, while reworking the top down design is still a fairly lightweight task.

Regards, Steve

I'd like to illuminate that with an example. One project needed to control a bunch of switches, implemented as bit-I/O . The top-down plan called for the functions (in C usage) on(), off(), and toggle(). It was known at planning time that actual outputs would be word wide. The bottom-up design immediately turned up a snag. The I/O device's state couldn't be read, so an image of its state would need to be kept in memory. With the switch bank serving several tasks, that might have necessitated the inclusion of an otherwise unneeded semaphore system. Discovering that late in a top-down implementation would have meant a lot of code rework. (That's all subjunctive because I built hardware to avoid the problem. The freedom to do that isn't always to be had.)

Jerry

Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

As with most approaches to any problem, the appropriate method should be used. Properly mixing the top-down and bottom-up methods to your needs. Some problems are best solved by building up a solution, others by decomposing or structuring the proposed solution, a few rare instances may even need a middle-out approach if your existing solution base is the inside (not top or bottom) for the final solution. Refactoring, reworking, or whatever is always available to revise an appropriate solution. Use the techniques that best fit your needs and design approach.

David

If you built the hardware to avoid the problem after it was discovered then it's evidence to support bottom-up implementation -- because the problem would not have been discovered at the bottom of the software to be fixed at an even lower level.

Tim Wescott Wescott Design Services http://www.wescottdesign.com

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required