Programming paradigms

A programmer can follow different approaches, also known as programming paradigms, when writing code.  Two of the most important programming paradigms are the procedural and the Object-Oriented ones.

Usually a programming language falls under one paradigm like  Ruby , that is mainly an OOP language. But some other languages as JavaScript can be multi-paradigm and support procedural, object-oriented (prototype-based) and functional programming styles.

The main difference between them is how you organise your code:

-In a procedural approach your code is a list of instructions or steps to be carried out.

-In an Object-Oriented approach your code is organised using objects and classes.

Reading about the different paradigms I found lots of new and very complicated concepts as: modularisation as a main trait of the procedural paradigm, and data abstraction, encapsulation, polymorphism, inheritance and serialisation-marshalling as traits for the Object-Oriented paradigm.

Apart from the desire to look the other way, I decided create some short and easy to understand definitions. Maybe¬†the next time I find these concepts I don’t feel so uncomfortable!

  • Modularisation: It¬†is used for reducing the complexity of a system subdividing a computer program into modules¬† or separate software components.
  • Data abstraction:¬†It¬†is the reduction of¬†data¬†to a simplified representation of the whole.¬† In OOP the programmer would just keep the relevant data inside the object hiding everything else.¬†Data hiding¬†is a software development technique.
  • Encapsulation : It is the inclusion within an object¬† of all the data and methods need for the object to function.
  • Polymorphism: It is the ability to present the same interface (Shape) for differing data types (square, circle, etc).
  • Inheritance: It¬†enables new objects (subclasses or derived classes) to take on the properties of existing objects (superclasses or base classes).
  • Serialisation and marshalling:¬† Both are for transforming objects into series of bits. In particular, marshalling is about getting parameters from here to there, while serialisation is about copying structured data to or from a primitive form such as a byte stream. What is byte stream? A¬†sequence¬†of bits. What is a bit? It is the smallest unit of data in a computer. And what am I doing right now? Yak shaving!