a user ask this question. We know that cars break down, but that’s because of something physical. now the question is why software isn’t as reliable as car? why did software always went on error? why is there so many bugs there?
before we delve deeper into the difference between software and machinery. let me explain something first, car and software are two different things. car is physical whilst software is virtual. in car, there are many physical parts that involve. and in software things is a bit more complicated as there are many millions of “parts”. and this part can be called a state.
here is an explanation from wikipedia regarding program state
One of the key concepts in computer programming is the idea of state, essentially a snapshot of the measure of various conditions in the system. Most programming languages require a considerable amount of state information in order to operate properly – information which is generally hidden from the programmer. For a real-world example, consider a three-way light switch. An ordinary switch turns on a light when it’s in the “up” position, but in a three-way switch the “up” position could be on or off, depending on the state or “configuration” of the other switch, which is likely out of view.
A program that is running and uses 1MB of RAM has a million bytes of state. That’s far more state than any normal mechanical system. A mechanical non-moving part has no state. A mechanical moving part has its position (one variable).
in software there will be combination of states that never get tested because they happen so rarely. In a mechanical system (like a car) it is easy to check that mechanical parts do not hit one another during operation, because we can see the car’s running with our own eyes, whilst in software we need to peruse the code thoroughly to understand how the software is really working.
now you may have known that software is really complicated thus this flaws created another programming paradigm. that’s called functional programming. functional programming create a software that acts like a machine by using smaller states and mainly in use in nuclear power plant to reduce programming error that Object Oriented or Modular programming has and this topic about functional programming shall I explain it in the later post.