Object Oriented Programming using C#

(backadmin) #1
Object Oriented Programming using C#
Creating And Using Eceptions

Feedback 2

If the code was amended to allow for the possible NULL value returned it would work – however this protection is insecure
as it relies on the programmer to spot this potential critical error.

When writing the GetClient() method the author was fully aware that a client may not be found and in this case decided
to return a NULL value. However this relies on every programmer who ever uses this method to recognise and protect
against this eventuality.

If any programmer using this method failed to protect against a NULL return then their program could crash – potentially
in this case losing the bank large sums of money. Of course in other applications, such as an aircraft control system, a
program crash could have life threatening results.

A more secure programming method is required to ensure that that a potential crash situation is always dealt with!

Such a mechanism exists - it is a mechanism called ‘exceptions’.

By using this mechanism we can trap any potential errors in our code – preventing and managing crash situations.

Stand out from the crowd
Designed for graduates with less than one year of full-time postgraduate work
experience, London Business School’s Masters in Management will expand your
thinking and provide you with the foundations for a successful career in business.
The programme is developed in consultation with recruiters to provide you with
the key skills that top employers demand. Through 11 months of full-time study,
you will gain the business knowledge and capabilities to increase your career
choices and stand out from the crowd.
Applications are now open for entry in September 2011.
For more information visit http://www.london.edu/mim/
email [email protected] or call +44 (0)20 7000 7573

Masters in Management

London Business School
Regent’s ParkLondon NW1 4SA
United KingdomTel +44 (0)20 7000 7573
Email [email protected]/mim/

Fast-track


your career


Please click the advert

Free download pdf