Successful Endeavours - Electronics Designs That Work!

Software Design


Good Documentation

Good Documentation makes it possible for other people to leverage work already done. It can be the difference between something being usable and it being scrapped or ignored. We have already looked at some aspects of how Software Documentation can be created. An example being shown below.

 

Doxygen Call Graph

Doxygen Call Graph

This is only one form of documentation. To use a Software Module you will want the API definition. Here is an example in Doxygen format of a readily usable interface. Not much mystery here. Note that the hyperlinks have been removed to stop is using links you can’t access. Normally every definition is hyperlinked so you can go right to it.

Module MS_RNG

A 32 bit Pseudo Random Number Generator which passes the Die Hard test suite for randomness. It also provides 8 and 16 bit random numbers and a complex seed arrangement.

Functions
void MS_RNG_Seed (U32_t seed1, U32_t seed2)
use the seed values to churn the seed as much as you can
U32_t MS_RNG_Get_U32 (void)
get the next U32 value in the random number sequence
U16_t MS_RNG_Get_U16 (void)
get the next U16 value in the random number sequence
U8_t MS_RNG_Get_U8 (void)
get the next U8 value in the random number sequence

Function Documentation

U16_t MS_RNG_Get_U16 ( void  )

get the next U16 value in the random number sequence
Returns U16 random number

 

  U32_t MS_RNG_Get_U32 ( void  )

get the next U32 value in the random number sequence
Returns U32 random number

 

U8_t MS_RNG_Get_U8 ( void  )

get the next U8 value in the random number sequence
Returns U8 random number

 

void MS_RNG_Seed ( U32_t  seed1,
U32_t  seed2 
)

use the seed values to churn the seed as much as you can

Parameters

seed1 = first seed component
seed2 = second seed component

Returns void

So it should prove straight forward to use a module documented like this. Of course I’ve picked a simple example.

O’Reilly recently published a great article on this and so I’m going to summarise here and you can check out the full article for the rest of the details.

  • Write documentation that is inviting and clear
  • Write documentation that is comprehensive, detailing all aspects of the project
  • Write documentation that is skimmable
  • Write documentation that offers examples of how to use the software
  • Write documentation that has repetition, when useful
  • Write documentation that is maintained and up to date
  • Write documentation that is easy to contribute to
  • Write documentation that is easy to find

Seems perfectly sensible to me. If you want you software to be reused, make it as inviting as possible for subsequent developers to be able to engage with, understand, and quickly leverage what you have already done.

You can read the complete article at the eight rules of good documentation.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2018 Successful Endeavours Pty Ltd.

Software Development Estimation

in Software Costing we looked at some typical ways of determining the likely cost of a Software Development project. One way was to look at how much typing was involved. This is not considered the best approach as the cartoon below demonstrated.

Software Estimation

Software Estimation

I prefer to spend more time thinking about the problem and less time typing. Among other things this reduces the amount of typing required.

The other example was by looking at the study by VDC Research where the median Software Development project had a cost of US$12.5o per line of code. Which is also very expensive by our reckoning. But these are actual figures. The hard part is working out how many lines of code (LOC) will be required before you have written them.

Estimation by Function Points

So I was interested when The Embedded Muse, a software development newsletter authored by Jack Ganssle, published some data from Capers Jones who is a legend in the Software Development industry for his statistics on the Software Development Process.

Capers Jones & Quote

Capers Jones & Quote

My first thought was that I fully agree with the quote. Let’s have a look at it in detail.

High-quality software is not expensive. High-quality software is faster and cheaper to build and maintain than low-quality software, from initial development all the way through total cost of ownership.

The assertion is that if you have a way to measure Software Quality, and you stick to good Software Development Process and the creation of High Quality Software, the overall cost will be lower. This might seems counter intuitive to some of our prospects given the development process requests we get, but I think it is spot on. Here are the other items of interest.

According to Capers Jones, a very rough guide to estimating the number of people needed on a project, and the project’s duration, is:

  • Number of developers = (function points)/150
  • Calendar months = (function points) x 0.4
  • One function point is approximately 130 lines of C Code

So for a typical 20,000 lines of C Code project, we would expect 154 function points with 1 developer required and it would take 5 years. If I look at one of the Industrial Control projects we did then that was 60,000 lines with 3 developers (that part works) and 8 months overall (rather than 5 years). So I’m not convinced the time component of the formula works. Maybe it is too heavily influenced by larger projects. But the number of developers seems to be about right.

Again, these are actual project figures and not some abstract model. And if you don’t use good Software Development Process then the cost of debugging and fixing issues in the field will typically dwarf the cost of writing the code.

Software Development Metrics

So I thought I’d do a summary of the Software Development Metrics we have accumulated over time as this may help with the Software Estimation process. This is what it looks like in our world of typically smaller projects (less than 100K LOC) reflected through the data above:

  • Number of developers = LOC  / 20,000
  • Number of months = LOC / ((number of developers) x 6600)
  • Cost of development = $4.80 per LOC

This assumes good process and average project difficulty. Things that will push a project way past this are code space constraints, processing power constraints, poorly defined requirements and substantial changes of direction mid project. But it does give some way to at least know the ballpark.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2018 Successful Endeavours Pty Ltd.

Embedded Systems Safety

In The Internet of Insecure Things we got a glimpse into the source of some of those security issues. Today we benefit from another infographic reproduced courtesy of the Barr Group. This time it is a look at the underlying Software Security that is so important to improving the future and no making it even more vulnerable. So read through the list of areas you might not be paying enough attention to. I know there are a couple we are still working on.

The State Of Embedded Systems Safety

The State Of Embedded Systems Safety

Food for thought. Above I reproduced a low resolution version with their permission. You can get a full resolution version by registering at the Barr Group website.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2018 Successful Endeavours Pty Ltd.

Top Programming Languages

Each of the past 3 years IEEE Spectrum have conducted a survey of the Top Programming Languages. This year they have done it again and the results are in. The overall winner is Python with C taking out the Embedded Software category.

Here is the overall list covering all development platforms considered.

Top Programming Languages 2017

Top Programming Languages 2017

So Python is the winner and for the first time. It’s continued rise in usage is a testimony to the usefulness of the language and the ecosystem that sits around it. But the top 4, Python, C, Java and C++ are a long way ahead of the rest overall.

Top Embedded Programming Languages

And for Embedded Software development we have.

Top Embedded Programming Languages 2017

Top Embedded Programming Languages 2017

There has been some discussion around whether Arduino is a Language since it is a platform with a development tool set built around C and some libraries. But this is a compilation of responses from software development practitioners and so they obviously think it is.

The surprise for me is Haskell. Functional Programming is still in its infancy and there is a lot we don’t fully get about it so I was surprised to see it ranking so highly. What would be really useful is to also get an understanding of what types of problems/solutions/applications the programming was being applied to rather than just the language the solution was implemented in.

Of interest is the correlation with the languages we use here at Successful Endeavours. Here is our short list:

  • C
  • C++
  • Python
  • PHP
  • Perl
  • VHDL
  • Assembly
  • HTML
  • Arduino

The previous results can be found in

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2017 Successful Endeavours Pty Ltd.

Software Costing

There is an old saying that goes something like this: “hardware is almost free and comes from China; but software is actually free and comes from India”. Actually not such on old saying, and certainly not true. But we do see signs of this myth being alive and well when providing project pricing and estimates for new clients. I covered some of this in Software Estimation.

Software Estimation

Software Estimation

This was about how to try and work out a Software Development Budget in advance. Including forgetting that the entire Software Development Process involves more than just typing. So is it possible to know what it really  costs from real world (non-imaginary) data?

Software Cost

The answer is that it is. My thanks got to VDC Research who recently did a survey of Embedded Developers and made the data available to subscribers of The Embedded Muse, a software development newsletter authored by Jack Ganssle. If you develop software, especially for Embedded Systems, I recommend you sign up if you aren’t already a subscriber.

Jack Ganssle

Jack Ganssle

Here is a summary of some statistics that gave me insights into real Software Development Costs.

Average Median
Project Team Members 19 7
Project Cost $27,000,000 $250,000
Lines of Code 627,000 20,000

So that is a big spread. Our projects are often below the median level shown here so I was interested to work out what these statistics translate to in cost. The $ are all USD$. And the large lines of code average probably represents larger projects using a major Operating System such as Linux as part of the project.

Cost per team member Cost per line of code
Average $1,421,052 $43.06
Median $35,714 $12.50

My first thought is that we don’t charge enough if these are industry typical figures. A bit more thinking shows the process costs of much larger systems. As far as I know there would be few software developers actually getting $1M for their part in the project. And there will be tools costs also included. The statistic missing for me was the duration the money was spent over. We typically budget $5 per line of code for larger projects (20K lines is a decent sized project for a small embedded system) and $2.50 for smaller ones (say 5K lines of code of less).

So there you have a really rough way of estimating cost based on Lines of Code and number of Software Developers involved.

The above is a very small example of the data collected by VDC Research so consider signing up if you want to see all of it.

Software Lines of Code

Software Lines of Code, or LOC, is only one measure of a project. There is much more to consider. We had a recent project where we were asked to fix 50K lines of code for a product that was proving unreliable. So I ran RSM over the top of it to get the average Cylcomatic Complexity and got 6.2! Those who know what that means probably have no idea how you could write code that hard to debug. And no, it wasn’t lots of switch statements. So is the correct answer $250K at $5 per line of code for a complete rewrite?

The answer is a resounding “NO”!

And the reason is because we redesigned the control flow and changed the UI to a table driven design and reduced a spaghetti mess of 50K lines of code down to 10K lines of cleanly designed code. Which is a budget more like $50K. In this case, it was much more cost effective to redesign from scratch than to try and rescue it. We also fixed the hardware design as that was in part responsible for the unreliability.

So the other answer is that good requirements analysis and good design will reduce Software Cost.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In Australia. Ray Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2017 Successful Endeavours Pty Ltd.

IoT Security

The Internet of Things, or IoT, is a pivotal component of the future and is driving initiatives from Smart Cities through Ubiquitous Computing and Augmented Reality. Of course the next step up from Smart Cities is a Smarter Planet. But we aren’t at Smart Cities yet.

An enabling technology like IoT can also have roadblocks to adoption. The principal ones being addressed now are:

  • power consumption
  • cost of goods
  • size
  • security

The biggest issue right now is IoT Security. Recent DDoS (Distributed Denial of Service) attacks have used IoT Devices as the attack launchers. They are being selected because many have weaker security than fully fledged computing devices.

DDoS or Distributed Denial of Service

DDoS or Distributed Denial of Service

In a recent article on IEEE Spectrum on the Path to IoT Security it is argued that IoT Manufacturers must take responsibility and not leave it up to end users. There is also a role of industry standards however no clear set of standards have yet been agreed. So although 2016 is the Year of IoT, with this being the single biggest category of product shipped, it is still very early days where things like IoT Security and IoT Interoperability are concerned.

IoT Security versus Software Security

This is not a new dilemma. Software Security is always important and it becomes increasingly important as Internet Communicating IoT Devices become more widespread. One apparent assumption underlying all this is that an IoT Device must be a fully IP Stack capable platform. That is not necessarily the case. In the video I shared about our Water Metering Remote Telemetry project one thing I didn’t mention is that the data stream is all driven from the IoT Device. There is nothing to log into. You can’t patch it with a Windows, Linux or other OS patch to override its function. It is not capable of being used in a DDoS attack because you can’t get to anything in it that can do that. So it is inherently secure against that form of risk.

Internet of Things Cconnectivity

Internet of Things Connectivity

However there are other risks. Nick Hunn has an insightful piece on Wireless Security for IoT where he argues that we are declaring security is present while having no evidence of proving it. That article is a little dated but the basic tenets still seem to apply. Just because a manufacturer or industry alliance states they have addressed security, it doesn’t make it automatically true.

So IoT Security is Software Security with the added component of protecting the physical hardware.

IoT Security in the Future

We still don’t have standards, so for now, individual device manufacturers and alliance members will need to ensure they have adequate security out of the box. The level of security required is determined by the importance of the data, either its security against unauthorised access, or its integrity against falsification. And at the asset level, its proof against either being disabled or used as an attack vector.

As an example, I am personally not so concerned if a hacker can find out how much electricity use my smart meter is reporting. Unless they get time of day usage and can correlate with other data sources to work out in advance when we aren’t home so they can rob us. My energy provider probably cares more about this data for all its customers coming into a competitors hands. Or maybe not. But I do care that I don’t get an outrageous bill because they were able to send fake data for my account to a server.

And energy grid managers care about usage data and Smart Meter appliance management being used to crash an entire electricity grid!

In the case of the Water Metering Remote Telemetry project I care that it remains online and working because otherwise someone will have to travel a long way to fix it. We have a facility in Gilgandra that is 892Km away as the crow flies. It will take a full day to get there and then another to back again. So I want it to be proof against some hacker disabling its communication ability. Since it has a physical antenna, I do care about that being hard to break. So some of these devices are put above normal reach and everything is inside a secure plastic case including the antenna. And our customer wants to know the reported water usage is correct. This means no missing data, and no incorrect data. They use the data to bill their customers.

One simple way to mess up data is a Replay Attack. If you can intercept and copy a data transmission, then you can play back that transmission any time you want to. You don’t even have to understand the content, the encryption, anything. Simply capture a HTTP POST or GET and replay it. Why does this matter? Because if the data transmitted is the volume of water used since the last report, then every time you play it back, you add to someone’s water bill. Or you distort the level of water the system believes is in a tank or reservoir. You can protect against these attacks in a number of ways but you have to consider the need to protect against them first of all.

There is a large volume of material on this topic. Here are some additional articles you might find useful for broadening your perspective on this topic:

I’m sure you won’t find it hard to search out a lot more articles. Just consider this. Once it has an Internet connection, any device can access anywhere in the world. And most firewalls protect against incoming attacks. A corrupted device on the inside can get out any time it wants to.

Internet of Things Global Reach

Internet of Things Global Reach

And if you want a really interesting view of what this could be like 10 years from now, I recommend reading Rainbow’s End by Vernor Vinge. Enjoy. And this isn’t my first reference to this book because I think it is fairly prescient in its exploration of a most probable future.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In Australia. Ray Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2016 Successful Endeavours Pty Ltd.

Top Programming Languages

We previously look at the Top Programming Languages for 2014 and IEEE Spectrum have released the same information for 2015.

Top 10 Programming Languages 2015

Top 10 Programming Languages 2015

One interesting thing is that use of C, the oldest of the top 5 languages, is increasing.

You can read the full article at The 2015 top ten programming languages including how they assessed which languages are used. They also have a App you can purchase if you want finer detail and to always be up to date.

Successful Endeavours specialise in Electronics Design and Embedded Software Development. Ray Keefe has developed market leading electronics products in Australia for nearly 30 years. This post is Copyright © 2015 Successful Endeavours Pty Ltd.

Product Development

As a process, Product Development can be handled a number of different ways. And if your product only requires input from a single technical discipline which you are very experienced in, then you can usually predict everything you need to do and just make sure it all happens the right way.

But if the product is complex, involves many disciplines, and has unknowns about the technical direction to take, then it can sometimes resemble a roller coaster ride more than it does a straight forward journey. And there can be unexpected bumps along the way.

Our most recent employee brought this video to my attention and I thought it covered this topic really well. We used it for an in house lunch and learn session so I recommend you check it out to. It isn’t short so you might want to set aside a time you can sit back and enjoy it.

The presented is Andrew “Bunnie” Huang and the conference he is presenting at is linux.conf.au 2013. 

Quite a list of things you can run into just getting a fully package embedded computing device ready for market. The HDMI Man In The Middle exploit was my favourite part.

Successful Endeavours specialise in Electronics Design and Embedded Software Development. Ray Keefe has developed market leading electronics products in Australia for nearly 30 years. This post is Copyright © 2015 Successful Endeavours Pty Ltd.

Top Programming Languages

A recent survey of the most used Software Languages, also known as the Top Programming Languages,  has revealed what most would have guessed as to the most popular Software Development Languages in use. The survey was published on IEEE Spectrum and usefully allows you to look at the statistics for 4 types of software development in any combination you want to. The categories used for the breakdown of the statistics are:

  • Web
  • Mobile
  • Enterprise
  • Embedded

Web Development Languages

The most popular Web Development Language was Java followed by Python, C# and PHP. I was surprised that Python ranked so highly. I understand the Google use it but hadn’t realised it had become so prevalent. So I learnt something new from that part. This is one of the advantages of being part of the professional body like IEEE. The world we live keeps changing and expanding and this is one way to stay up with those changes.

Mobile Software Development

For Mobile Software Development the winner was again Java with C, C++ and C# coming next. So here we are still very C oriented even on the most modern platform around. And of course Java is also very C like in its structure having been developed to address some system level issues such as memory management and garbage collection that C requires you to handle manually.

Enterprise Software Development

Enterprise Software Development sees Java again a the winner with C, C++, Python and C# coming next. Again Python is higher than I expected but the rest makes sense. Given that this area represents one of the core infrastructure requirements of modern scale-able companies it is interesting to see how narrow we still are with the Software Languages we use.

Embedded Software Development

And finally to the world we mostly deal with, Embedded Software Development. The clear winner here is C followed by C++ and Assembler. I took a snapshot of the complete rankings. Embedded C remains the primary language for software development in embedded systems.

Top Programming Languages - an IEEE published survey

Top Programming Languages

You can see the full survey results at Top Programming Languages

The overall winner was Java when you take all 4 categories into account and that isn’t hard to accept given Java was the Top Programming Language in 3 of the 4 categories. So if you are thinking about what Software Languages you should learn, it depends on where you want to work and what you want to work on. For Embedded Software Development, it is still C and C++. For everything else, Java is core with C, C++, C# and Python all playing a part.

Successful Endeavours specialise in Electronics Design and Embedded Software Development. Ray Keefe has developed market leading electronics products in Australia for nearly 30 years. This post is Copyright © 2014 Successful Endeavours Pty Ltd

Viewpoints matter

How does the world look to you?

 This is often one of the areas where Engineers and Customers can get out of step. And in particular, is a big issue for Software Development and IT systems. Check out the image below.

Round or Square Columns

Round or Square Columns

Technical professionals such as Engineers and Software Developers tend to be detail driven and so probably look at the system from the ground up. So we would see round columns.  

Entrepreneurs and Business Owners tend to see the world from the top down and so would see square columns. And this difference in perspective can be a problem in implementing a solution that works for the customer.

So here we have an image that represents the potential difference between the Engineer Viewpoint and Customer Viewpoint.

Requirements Management

The real issue here is Requirements Management. This is one aspect of Software Development where I like the V Model for Software Development and the European Space Agency Software Engineering process. It splits the problem down into steps and also lets you know whose language the documents at the step are written in. So User Requirements are written in the language of the use. Technical Requirements are written in the language of the technical professionals. And Requirements Analysis is required to determine the relationship between the different viewpoints. For most projects the analysis is used to translate User Requirements to Technical Requirements. So now we can all have a viewpoint that we understand and it is linked.

The V Model for Software Development

V Model

The general steps are:

  • User Requirements – in the language of the user
  • Product Requirements – in the language of the user and relevant standards and market needs
  • Technical Requirements – derived from both the above and in the language of the technician
  • Functional Decomposition – breaking the problem down into specific functions to be performed
  • Architectural Decomposition and Requirements Allocation – working out that is done in hardware, software, locally, remotely …
  • Detailed Design and Module Specifications – specific modules to be designed and tested

So we move from user language to technical language in a structured way that allows us to understand was is required and make sure nothing has been missed.

User Requirements and Technical Requirements

Requirements Analysis

Product Development Process

The Product Development Process is intended to ensure that the product meets its requirements and is delivered on time and on budget. And regardless of the size of the project the above steps are required. Who does them and how they are done is less important than that they are done. Smaller projects might not require a formal approach but any significant project certainly does. And this also helps to overcome the difference in viewpoint between Technical Professionals and their Customers.

 The image for today’s blog post was provided courtesy of Dr Marc Dussault, The Exponential Growth Strategist who is always on the look out for examples of antimimeticisomorphism, which I am sure you’ll agree this is!

Successful Endeavours specialise in Electronics Design and Embedded Software Development. Ray Keefe has developed market leading electronics products in Australia for nearly 30 years. This post is Copyright © 2014 Successful Endeavours Pty Ltd

Next Page »