Appendix A: Principles of Object-Oriented Programming

 
Appendix A - Principles of Object-Oriented Programming
bySimon Robinsonet al.
Wrox Press 2002
  

Overview

In general, when learning a new language, a fair part of your effort is spent in learning the syntax of that language: how to declare variables , how to control the flow of execution, and so on. However, in order to write quality code in a language, you also need to understand the principles and methodologies behind the language. C# is a fully object-oriented language, so in order to create well-designed C# code you need to get to grips with its object-oriented features, and that means learning about Object-Oriented Programming ( OOP ).

In OOP, we aim to write easily maintainable and reusable pieces of code that can collectively perform very complex tasks . However, the whole structure of an object-oriented program is very different from the structure of an equivalent program written in procedural language. In this appendix, we are going to introduce the principles of object-oriented programming. Although we will have to learn some C# syntax (since we'll be presenting the examples in C#) the emphasis is on learning those principles which apply to OOP in general, no matter which language you are using.

OOP is an extremely powerful methodology. Once you've become used to writing your code using it, you will probably wonder how you ever got by without it. You'll find that it gives your code an intuitive, "natural" structure that is not possible with procedural languages, and is not really possible even in VB 6, which does implement a few object-oriented features.

We'll start by looking in some detail at the nature of an object before moving on to examine the concept of inheritance . Inheritance allows the code for classes to be reused in a very convenient manner, and is at the heart of object-oriented programming. We'll look both at how to code up inheritance in C# and at how you would normally use inheritance in your programs in more conceptual terms.

  


Professional C#. 2nd Edition
Performance Consulting: A Practical Guide for HR and Learning Professionals
ISBN: 1576754359
EAN: 2147483647
Year: 2002
Pages: 244

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net