Computer Science · Chapter 5
Study notes aligned to the official NEB syllabus.
The C programs of the previous chapter are written in the procedural style: the program is a list of instructions grouped into functions that act on data which is kept separate from them. This works, but as programs grow large the data and the functions that use it drift apart, and a change in one place can quietly break another. Object Oriented Programming (OOP) offers a different way of thinking: instead of separating data and functions, it bundles them together into objects that model real world things. This chapter explains the programming paradigms that lead up to OOP, the features that define it, and why it has become the dominant style for building large software. Languages such as C++, Java, Python and C# are object oriented.
A programming paradigm is a style or approach to writing programs, a way of organizing the code and thinking about the problem. Three paradigms lead to OOP:
goto) and global data. It is workable only for very small programs and quickly becomes tangled.