Next revision | Previous revision |
basic:programming_cpp [2024/10/10 07:52] – created azman | basic:programming_cpp [2025/02/14 13:17] (current) – azman |
---|
To go through this course, you're expected to have some basic computer programming knowledge (preferably C). | To go through this course, you're expected to have some basic computer programming knowledge (preferably C). |
| |
Object-oriented programming (OOP) is a programming technique that evolves from the more common procedural/modular programming. In procedural programming a solution usually revolves around breaking down a task into smaller ones and writing a function (or procedure - hence the word procedural) specifically to deal with each of that (usually single) small task. Thus, you see a lot of functions that takes data structure (usually in form of a pointer) as an argument. In contrast, object-oriented programming focus more on modelling a solution as an object - which can be an instance of a more generic category. As an object, the solution would have properties (merely a variable in procedural programming) that describes the object, and methods (functions in procedural programming) which are processes used to model how an object acts/reacts. Based on this, it is clear that object-oriented programming is a technique and not just language. So, writing a program in C++ (or using a C++ compiler) still doesn't qualify as implementing object oriented programming - it is still possible to write a solution purely based on modular programming using C++ (especially when the all classes have public members only). | Object-oriented programming (OOP) is a programming technique that evolves from the more common procedural/modular programming. In procedural programming a solution usually revolves around breaking down a task into smaller ones and writing a function (or procedure - hence the word procedural) specifically to deal with each of that (usually single) small task. Thus, you see a lot of functions that takes data structure (usually in form of a pointer) as an argument. In contrast, object-oriented programming focus more on modelling a solution as an object - which can be an instance of a more generic category. As an object, the solution would have properties (merely a variable in procedural programming) that describes the object, and methods (functions in procedural programming) which are processes used to model how an object acts/reacts. Based on this, it is clear that object-oriented programming is a technique and not just language. So, writing a program in C%%++%% (or using a C%%++%% compiler) still doesn't qualify as implementing object oriented programming - it is still possible to write a solution purely based on modular programming using C%%++%% (especially when the all classes have public members only). |
| |
The main features of OOP are encapsulation, inheritance and polymorphism. The page on [[wp>object-oriented programming|wikipedia]] also list others, but I feel those can actually be sub-categorized under (or stems from) the mentioned features. So, a language that supports these features should qualify as a language that supports OOP (i.e. enables implementing a solution using OOP technique). C++ and Java are the early popular implementations (C++ because of its roots in C and Java because.... well, it's Java! Maybe also because it's among the first to promote cross platform implementation). | The main features of OOP are encapsulation, inheritance and polymorphism. The page on [[wp>object-oriented programming|wikipedia]] also list others, but I feel those can actually be sub-categorized under (or stems from) the mentioned features. So, a language that supports these features should qualify as a language that supports OOP (i.e. enables implementing a solution using OOP technique). C%%++%% and Java are the early popular implementations (C%%++%% because of its roots in C and Java because.... well, it's Java! Maybe also because it's among the first to promote cross platform implementation). |
| |
//To be continued...// | //To be continued...// |
===== Objective(s): ===== | ===== Objective(s): ===== |
| |
To familiarize with terms and stuffs in object-oriented programming. Also, basic transition from C to C++ will be demonstrated. | To familiarize with terms and stuffs in object-oriented programming. Also, basic transition from C to C%%++%% will be demonstrated. |
| |
==== What is OOP? ==== | ==== What is OOP? ==== |
| |
==== Why OOP? ==== | ==== Why OOP? ==== |
| |
| |
- (lec) course briefing and refresh basic programming | - (lec) course briefing and refresh basic programming |
- (lec) implementation platform revised (c++ instead of java) | - (lec) implementation platform revised (c%%++%% instead of java) |
- (lab) development environment (using mingw) | - (lab) development environment (using mingw) |
- (lab) refresh basic programming | - (lab) refresh basic programming |
- modular/procedural programming vs object-oriented programming | - modular/procedural programming vs object-oriented programming |
- from c to c++ | - from c to c%%++%% |
- basic overview of c++ | - basic overview of c%%++%% |
- keyword(s): structs, classes | - keyword(s): structs, classes |
- basic phonebook application | - basic phonebook application |