Week 1 Lecture 1 - C# Fundamentals
Introduction to OOPHistory
Computer programming is a step-by-step process. A computer program is a step-by-step set of instructions for a computer. Every computer program is an algorithm. The history of computer programming is a steady move away from machine-oriented views of programming towards concepts and metaphors that more closely reflect how we see and understand the world.
Programming languages allow programmers to develop software. The three major families of languages are:
– Machine languages– Assembly languages– High-Level languages
Machine language is comprised of 1s and 0s. It is also the “native language” of a computer. Machine language is difficult to program – one misplaced 1 or 0 will cause the program to fail.
Assembly languages are a step towards easier programming. Assembly languages are comprised of a set of elemental commands which are tied to a specific processor. Assembly language code needs to be translated to machine language before the computer processes it.
High-level languages represent a giant leap towards easier programming. The syntax of HL languages is similar to English. Historically, we divide HL languages into two groups:
– Procedural languages – Object-Oriented Programming (OOP) languages
Early high-level languages are typically called procedural languages. Procedural languages are characterized by sequential sets of linear commands. The focus of such languages is on the structure. Examples include C, COBOL, Fortran, LISP, Perl, HTML, VBScript.
The focus of OOP languages is not on structure, but on modeling data. Programmers code using “blueprints” of data models called classes. Examples of OOP languages include C++, Visual Basic.NET, and Java.
Brief Programming History of OOP
OOP is mainly a program design philosophy. OOP uses a different set of programming languages than old procedural programming languages (C, Pascal, etc.). Everything in OOP is grouped as self-sustainable "objects". Hence, you gain reusability using four main object-oriented programming concepts. In OOP programmers define not only the data type of a data structure but also the types of operations/methods (functions) that can be applied to the data structure. data structure becomes an object that includes both data and functions (methods) in one unit
Programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects. Eiffel, Actor, Emerald, JADE, Obix, Ruby, Python, Scala, Smalltalk, Self are pure OO languages. Delphi/Object Pascal, C++, Java, C#, VB.NET, Pascal, Visual Basic, MATLAB, Fortran, Perl, COBOL 2002, PHP, ABAP, Ada 95 are hybrid OO languages
A class is a prototype, idea, and blueprint for creating objects. An object is an instance of a class. A class has a constructor for creating objects. Class is composed of three things - name, attributes/properties, and methods.
A class is a definition of objects with the same properties and the same methods.
Almost everything in this world can be represented as an Object.
• A flower, a tree, an animal
• A student, a professor
• A desk, a chair, a classroom, a building
• A university, a city, a country
• The world, the universe
• A subject such as CS, IS, Math, History, …
• An information system, financial, legal, etc.
An object is an instance of a class. An object represents an entity, either physical, conceptual, or software
An Object is a Class when it comes alive! Examples
- Homo Sapien is a class, John and Jack are objects
- Animal is a class “Snowball”, a cat is an object
- Vehicle is a class, My neighbor's BMW is an object
- Galaxy is a class, the MilkyWay is an objec