Object Oriented Programming: OOP and The Programming Industry
Object Oriented Programming: OOP and The Programming Industry
Object Oriented
Programming
OOP and the programming industry
Patrick Villar
It shows how and what an OOP is; its usage, concepts features.
Object Oriented Programming
OOP is simply including objects outside like sound files, image files, video files or user-defined
files to design applications and computer programs. Some of OOP’s features or techniques are
Inheritance, Abstraction, Polymorphism and Encapsulation. Some if its basic concepts are Classes,
Objects, and Methods. OOP minimizes the fragmentation of codes making it easier to modify existing
codes and be used as objects instead. It helps the programmer to organize their own codes for
developing graphical user interface applications.
An advantage of OOP is at ease of modifying objects reducing the maintenance costs of the
system. OOP is also a complicated procedural programming but allows flexible interactions. According to
ArchWing Innovations “OO systems are also easier for non-technical personnel to understand and easier
for them to participate in the maintenance and enhancement of a system because it appeals to natural
human cognition patterns.” OOP can speed up developing time thus many objects are standard in some
systems and can be reused.
According to AWI there are almost two-dozen major OO languages, the leading commercial OO
languages are:
C++
Smalltalk
Java
C++
C++ is an OO version of C. It is compatible with C (it is actually a superset), so that existing C code can be
incorporated into C++ programs. C++ programs are fast and efficient.
Smalltalk
Smalltalk is a pure OO language. A rich class library and a dynamic development environment makes
Smalltalk a favorite of OO developers.
Java
Java is the latest, flashiest OO language. It has taken the software industry by storm due to its close ties
with the Internet and Web browsers. Java is a mixture of C++ and Smalltalk.
OOP and C#
The new programming language C# is fully object-oriented and in many respects combines the
best elements of C++, Smalltalk, Java, and Visual Basic. C# is closest to Java among other programming
languages, and the basic structure of the .NET environment is rather close to the Java environment, with
C# and other .NET languages generating an intermediate language, which executes on a virtual machine
(the Common Language Runtime). But C# contains some important enhancements. The most significant
is that in C# "everything is an object," as in Smalltalk. This uniformity greatly simplifies use of the
language, enabling numbers to be treated like objects, stored in collections, and so on. But whereas
Smalltalk paid a heavy performance penalty for such uniformity, C# has a unique concept of "boxing"
and "unboxing," in which a primitive value like a number can be "boxed" into an object wrapper when
there is need for the value to be treated as an object. But for usages where an object is not required,
simple values can be efficiently manipulated directly. http://zone.ni.com/
We can access an object’s data and behaviour through and interface. The object’s data and
behaviour is within the object so a program can treat it like a box accessible only through and interface.
Parts of an object
Interface
Behaviour
Member or instance variables
The code inside the method is a behaviour since it is the code that actually makes the object do the
work. Programs outside can use the object even if we change the implementation for as long as we
don’t change the interface. As long as method name, parameter and returned value is unchanged, we
can alter the behaviour for as long as we want.
Classes in C#
:base (argument-list)
:this (argument-list)
constructor-body—The block that contains the statements that initialize the object.
Namespaces
name, name1—A namespace name can be any legal identifier, and it can include periods.
type-declarations—Within a namespace, you can declare one or more of the following types:
another namespace, a class, interface, struct, enum, or delegate.
You can create as many namespaces in a file as you want; just enclose the code for each namespace in
the code block following the namespace keyword. For example, here's how we can put the Messager
class into the namespace Output:
namespace Output
{
class Messager
{
public string message = "Default message.";
To access Messager outside the Output namespace, you qualify its name as Output.Messsager, just as
you can qualify Console.Writeline as System. Console.WriteLine.
Some Examples
bool OnOff;
int volume;
int channel;
// accessor methods
SwitchOn() ;
SwitchOff() ;
int GetVolume() ;
int GetChannel() ;
Student Class Program
//Class
class Student
{
// Data Members
public string Name;
public int Age;
//Main
using System;
namespace CSTutorials
{
class Student
{
// Data Members
public string Name;
public int Age;
// Member Function
public void Display()
{
Console.WriteLine("Name {0}\n Age {1}", Name, Age);
}
}
class Program
{
static void Main(string[] args)
{
Student S1; // Declaration
S1 = new Student(); // Instantiation
S1.Name = "Kimi";
S2.Age = 25;
Summary
Programming is made easier and efficient because of the OOP’s concepts and features and
never ending improvement of the world of programming. More namespaces that we can include can
become or narrow down to small classes. Simply, OOP is used to make the programming industry
efficient in memory management and prevent the fragmentation of files used by users.
Very useful references
http://www.archwing.com/technet/technet_OO.html
http://www.c-
sharpcorner.com/UploadFile/tusharkantagarwal/objectorientedcsharp11162005070743AM/obj
ectorientedcsharp.aspx
http://cplus.about.com/od/learnc/ss/csharpclasses.htm
http://www.informit.com/articles/article.aspx?p=101373&seqNum=2
http://zone.ni.com/devzone/cda/ph/p/id/45
http://www.astahost.com/info.php/Tutorial-Lesson-4-Object-Oriented-
Programming_t15397.html
http://www.google.com.ph/