|By Stackify Blog||
|April 19, 2017 02:00 PM EDT||
Software Error vs Exception - In Real World Examples
By Matt Watson
After 15+ years of software development, I still use the words error and exception interchangeably.
But is there a difference between exceptions and errors?
I think it is best to make the distinction with some examples of errors vs exceptions.
Example #1: Dishwasher Errors
Let's use this example of a dishwasher. Both images depict a problem, or error, that happened with the dishwasher. One was clearly user error of putting in the wrong type of soap. The other was an error that the dishwasher recognized and showed an error code for this.
I think this dishwasher example perfectly sums up the difference between an error and an exception. Both of these problems were errors. The difference here is the designer and engineers designed the product to handle one of the errors. It was an exception that the engineering team knew how to detect and handle. The engineering team did not detect or handle the soap problem.
Exceptions are a type of error that is expected or known to occur.
Example #2: Software Avoiding a Car Crash
Let's take this example of a Tesla crash. The software within the car was able to detect a stopped vehicle. The software was designed to recognize this as a known problem, or as an exception to normal behavior. The car was not able to completely prevent the crash. But, the developers were able to execute special logic to slow the car down to at least minimum the effect of the problem. Exception handling logic is key to good software. As developers, we have to anticipate the types of errors that may occur and handle them properly.
Example #3: ATM
When you go to an ATM to withdraw money, you expect to actually get money, right? What if you don't have any money in your account? That would be a good example of an InvalidBankBalanceException.
If the developers didn't handle this correctly, they could be handing out money to people who shouldn't be receiving it.
Or what if the ATM itself didn't have any money? It would not be good if they deducted $100 from your account for the money you were withdrawing, but it didn't actually give you any.
How to Anticipate Application Errors
One of the keys to good software is good error and exception handling. It is a good best practice to always be on the defense as your write code. You have to pretend that everything is going to fail.
If you don't handle possible error scenarios, inevitably, they will happen and your users will have problems. Granted, some of them might be user errors and there may not be anything you can do about them. The dishwasher soap example is a good example of this. Of course, my favorite says is "if it can be null, it will be null".
Always anticipate possible exceptions and handle them properly.
public static void DoIt(string url)
WebClient client = new WebClient();
string response = client.DownloadString(url);
catch (WebException ex) when (ex.Response != null)
var response = ex.Response as HttpWebResponse;
Console.WriteLine("Error receiving web response. Status: " + response?.StatusCode);
catch (WebException ex)
Console.WriteLine("Error connecting to remote server: " + ex.Message);
catch (Exception ex)
Console.WriteLine("Unknown error occurred: " + ex.Message);
Be sure to check out our guide to exception handling.
I hope you enjoyed this real world guide to an application error vs exception. As a developer, part of our challenge is trying to anticipate all the problems that could happen. Sadly, we never can anticipate all of them. This is why all developers need a good error monitoring system.
The post Software Error vs Exception – In Real World Examples appeared first on Stackify.
NHK, Japan Broadcasting, will feature the upcoming @ThingsExpo Silicon Valley in a special 'Internet of Things' and smart technology documentary that will be filmed on the expo floor between November 3 to 5, 2015, in Santa Clara. NHK is the sole public TV network in Japan equivalent to the BBC in the UK and the largest in Asia with many award-winning science and technology programs. Japanese TV is producing a documentary about IoT and Smart technology and will be covering @ThingsExpo Silicon Val...
Apr. 30, 2017 03:45 AM EDT Reads: 9,434
In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential. Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...
Apr. 30, 2017 03:30 AM EDT Reads: 6,233
The 20th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held June 6-8, 2017, at the Javits Center in New York City, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Containers, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal ...
Apr. 30, 2017 02:45 AM EDT Reads: 1,756
The age of Digital Disruption is evolving into the next era – Digital Cohesion, an age in which applications securely self-assemble and deliver predictive services that continuously adapt to user behavior. Information from devices, sensors and applications around us will drive services seamlessly across mobile and fixed devices/infrastructure. This evolution is happening now in software defined services and secure networking. Four key drivers – Performance, Economics, Interoperability and Trust ...
Apr. 30, 2017 01:45 AM EDT Reads: 1,087
SYS-CON Events announced today that CollabNet, a global leader in enterprise software development, release automation and DevOps solutions, will be a Bronze Sponsor of SYS-CON's 20th International Cloud Expo®, taking place from June 6-8, 2017, at the Javits Center in New York City, NY. CollabNet offers a broad range of solutions with the mission of helping modern organizations deliver quality software at speed. The company’s latest innovation, the DevOps Lifecycle Manager (DLM), supports Value S...
Apr. 30, 2017 01:15 AM EDT Reads: 1,453
With billions of sensors deployed worldwide, the amount of machine-generated data will soon exceed what our networks can handle. But consumers and businesses will expect seamless experiences and real-time responsiveness. What does this mean for IoT devices and the infrastructure that supports them? More of the data will need to be handled at - or closer to - the devices themselves.
Apr. 30, 2017 12:15 AM EDT Reads: 1,202
Web Real-Time Communication APIs have quickly revolutionized what browsers are capable of. In addition to video and audio streams, we can now bi-directionally send arbitrary data over WebRTC's PeerConnection Data Channels. With the advent of Progressive Web Apps and new hardware APIs such as WebBluetooh and WebUSB, we can finally enable users to stitch together the Internet of Things directly from their browsers while communicating privately and securely in a decentralized way.
Apr. 29, 2017 11:15 PM EDT Reads: 9,243
In his keynote at @ThingsExpo, Chris Matthieu, Director of IoT Engineering at Citrix and co-founder and CTO of Octoblu, focused on building an IoT platform and company. He provided a behind-the-scenes look at Octoblu’s platform, business, and pivots along the way (including the Citrix acquisition of Octoblu).
Apr. 29, 2017 10:45 PM EDT Reads: 1,821
Multiple data types are pouring into IoT deployments. Data is coming in small packages as well as enormous files and data streams of many sizes. Widespread use of mobile devices adds to the total. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will look at the tools and environments that are being put to use in IoT deployments, as well as the team skills a modern enterprise IT shop needs to keep things running, get a handle on all this data, and deli...
Apr. 29, 2017 10:30 PM EDT Reads: 2,782
Grape Up is a software company, specialized in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market across the USA and Europe, we work with a variety of customers from emerging startups to Fortune 1000 companies.
Apr. 29, 2017 10:15 PM EDT Reads: 2,611
Financial Technology has become a topic of intense interest throughout the cloud developer and enterprise IT communities. Accordingly, attendees at the upcoming 20th Cloud Expo at the Javits Center in New York, June 6-8, 2017, will find fresh new content in a new track called FinTech.
Apr. 29, 2017 10:00 PM EDT Reads: 2,648
SYS-CON Events announced today that Interoute, owner-operator of one of Europe's largest networks and a global cloud services platform, has been named “Bronze Sponsor” of SYS-CON's 20th Cloud Expo, which will take place on June 6-8, 2017 at the Javits Center in New York, New York. Interoute is the owner-operator of one of Europe's largest networks and a global cloud services platform which encompasses 12 data centers, 14 virtual data centers and 31 colocation centers, with connections to 195 add...
Apr. 29, 2017 09:30 PM EDT Reads: 2,290
The Internet of Things is clearly many things: data collection and analytics, wearables, Smart Grids and Smart Cities, the Industrial Internet, and more. Cool platforms like Arduino, Raspberry Pi, Intel's Galileo and Edison, and a diverse world of sensors are making the IoT a great toy box for developers in all these areas. In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists discussed what things are the most important, which will have the most profound e...
Apr. 29, 2017 09:30 PM EDT Reads: 2,561
SYS-CON Events announced today that Hitachi, the leading provider the Internet of Things and Digital Transformation, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Hitachi Data Systems, a wholly owned subsidiary of Hitachi, Ltd., offers an integrated portfolio of services and solutions that enable digital transformation through enhanced data management, governance, mobility and analytics. We help globa...
Apr. 29, 2017 09:15 PM EDT Reads: 1,583
SYS-CON Events announced today that Grape Up will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct. 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company specializing in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market across the U.S. and Europe, Grape Up works with a variety of customers from emergi...
Apr. 29, 2017 08:30 PM EDT Reads: 2,466
@ThingsExpo has been named the Most Influential ‘Smart Cities - IIoT' Account and @BigDataExpo has been named fourteenth by Right Relevance (RR), which provides curated information and intelligence on approximately 50,000 topics. In addition, Right Relevance provides an Insights offering that combines the above Topics and Influencers information with real time conversations to provide actionable intelligence with visualizations to enable decision making. The Insights service is applicable to eve...
Apr. 29, 2017 08:15 PM EDT Reads: 3,112
SYS-CON Events announced today that Hitachi Data Systems, a wholly owned subsidiary of Hitachi LTD., will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City. Hitachi Data Systems (HDS) will be featuring the Hitachi Content Platform (HCP) portfolio. This is the industry’s only offering that allows organizations to bring together object storage, file sync and share, cloud storage gateways, and sophisticated search an...
Apr. 29, 2017 07:30 PM EDT Reads: 840
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
Apr. 29, 2017 07:15 PM EDT Reads: 1,380
@GonzalezCarmen has been ranked the Number One Influencer and @ThingsExpo has been named the Number One Brand in the “M2M 2016: Top 100 Influencers and Brands” by Analytic. Onalytica analyzed tweets over the last 6 months mentioning the keywords M2M OR “Machine to Machine.” They then identified the top 100 most influential brands and individuals leading the discussion on Twitter.
Apr. 29, 2017 07:00 PM EDT Reads: 1,573
SYS-CON Events announced today that T-Mobile will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on ...
Apr. 29, 2017 05:15 PM EDT Reads: 1,606