element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Embedded Forum TDD and Embedded Programming
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 15 replies
  • Subscribers 468 subscribers
  • Views 1386 views
  • Users 0 members are here
  • tdd
Related

TDD and Embedded Programming

mconners
mconners over 11 years ago

A while ago, during the "Help a STEM Educator Out" thread, the topic of TDD was discussed briefly. I noted that I was a proponent, but I felt the challenges to developing the tools and frameworks for embedded development would be daunting.

 

I was not aware at the time, but someone has addressed this.

 

https://www.renaissancesoftware.net/blog/

 

This is the blog of James Grenning, who had written a book on the topic in 2011.

 

The Pragmatic Bookshelf | Test Driven Development for Embedded C

 

There exist on the web links to free versions of an ebook, but I'm not sure whether they are legitimate copies, so I won't link them here.

 

I have skimmed the book and it appears to be very well written. With a forward by Bob Martin, who is one of the chief proponents of TDD and agile.

 

I was fortunate enough to have been taught TDD by "Uncle Bob", as he is called, and another person mentioned in the book, Michael Feathers.

 

So to me, his endorsement carried a lot of weight.

 

One of the things I like about the book is that it emphasizes software development as a craft, and developers as craftsman.

 

I plan to investigate adding these methods to my embedded development.

 

Mike

  • Sign in to reply
  • Cancel

Top Replies

  • morgaine
    morgaine over 11 years ago in reply to mconners +3
    Michael Conners wrote: in order for things to be testable, they have to be decoupled. and Andy Clark wrote: It makes you think more about what you are trying to achieve These are two slightly…
  • mconners
    mconners over 11 years ago in reply to johnbeetem +1
    Hi John, I definitely think you missed something. Realize the design/development part of this is at the unit level. You still have system level integration tests and all the other things that are important…
  • morgaine
    morgaine over 11 years ago +1
    I suggest that this thread be moved out of Top Members and into some area where it's more directly on topic and is available to everyone, for example the Embedded Group . Morgaine.
  • morgaine
    morgaine over 11 years ago in reply to mconners

    Michael Conners wrote:

     

    in order for things to be testable, they have to be decoupled.

    and

    Andy Clark wrote:

     

    It makes you think more about what you are trying to achieve

     

    These are two slightly different aspects of the same very important message:

     

    If you don't know where you want to go, you probably won't get there.  Or, in SoftEng speak, know your requirements.

     

    Moreover, you need to know your requirements at every stage and in every iteration of the development process (regardless of which methodology you are using officially or unofficially), and hand-waved requirements in the back of your mind are absolutely not adequate --- that approach will get you into a tangle very rapidly even on one-person projects.  Software is far too complex to be created by the seat of your pants unless it's very trivial indeed.

     

    Any form of TDD will help you to know where you want to go because it is documenting requirements (as executable tests), and as Michael mentioned, the need to test your code will drive you towards creating modular, cohesive, and strongly decoupled subunits.  This assumes of course that you embrace testing strongly and honestly and don't just pay it lip service --- it pays back value in proportion to the time invested in it.  What's more, and this is extremely important for almost every project under the sun, executable tests allow you to perform regression testing automatically.  This helps immensely not only during hour-to-hour development as updated modules are checked in, but even more so when it's a long-lived project and understanding how older parts work ends up being forgotten because old personnel have left or simply because of the mists of time.  The tests won't forget.

     

    Unfortunately there is a fly in the ointment.  Testing is limited by extent of test coverage and by intrinsic observability and testability of what you want to test.  Full test coverage of non-trivial software systems is generally not possible, because the state space of even quite small software systems tends to be vastly beyond the capability of current-day computers to examine and test fully in reasonable time.  As a result, developers have to pick and choose what to test carefully, and it's a delicate balance that is aided by experience but never fully understood.  Theory doesn't help much in this area, because "what's important" is a semantic issue that CompSci is rather powerless to address.  My suggestion:  add semantic information to your tests so that explanations appear in your regression fault logs.  Then when things fail during regression testing, some of the thinking in the designer's mind will appear in the logs, which helps a huge amount by persisting old understanding and triggering the memory of it.

     

    TDD *can* be an excuse for not thinking about and documenting your requirements and design, but it can also be a very effective means of capturing requirements and design details in executable code which can be invaluable.  As in so many areas, an expert craftsman will produce an expert job while a poor one will produce a mess, whatever tools they are given.  The blame for delivering a poor product can't fall on TDD (nor on any other methodology), only on people who use their tools poorly.

     

    Morgaine.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • DAB
    DAB over 11 years ago in reply to morgaine

    Morgaine is correct.

     

    Until you vet all of your requirements and determine what you need to test and what values you need to measure, you are not ready to build anything.

    Requirements analysis and test planning are concurrent activities.  They must both be completed before you begin to design your system.

    You need the testable data to determine if you use hardware or software techniques for implementation.

    Your design establishes the needed performance for each of your HW and SW components.

     

    These issues are at the heart of TDD.  Once you know explicitly what you need to do, you have a much better chance of a successful project.

     

    Unless you really like to spend long hours testing, rewrite, rebuild, testing, ...

     

    Never liked that approach myself, that is why I quickly learned structured design methods.  They do work.  They also free up your weekends for other things.

     

    DAB


    .

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • morgaine
    morgaine over 11 years ago

    I suggest that this thread be moved out of Top Members and into some area where it's more directly on topic and is available to everyone, for example the Embedded Group.

     

    Morgaine.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • morgaine
    morgaine over 11 years ago in reply to DAB

    DAB wrote:

     

    Requirements analysis and test planning are concurrent activities.

     

    That's a very good way of expressing it.

     

    I would add that they are interdependent activities, because a requirement that is not testable cannot be known to have been achieved, and it is also at risk of damage in subsequent development.  The two activities have a very intimate relationship.  Treating them as separate (for example, one party setting requirements without involving the test writers) is a recipe for failure.

     

    Morgaine.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • bluescreen
    bluescreen over 11 years ago in reply to morgaine

    Good idea, Morgaine.


    I'll move it over.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
<
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube