Functional vs Object-Oriented Programming

Functional vs Object-Oriented Programming

Functional Programming

Functional Programming is a technique that mainly depends on evaluating functions and developing the code structure. The primary goal is here to get input data on one side, process the data then produce the output result on the other side. We try to organize our functions as pure functions if it is possible, this is because the outputs of a function purely rely on arguments of the function and there is no mystery magic that is happening behind the scenes, this is called removing side effects in your code.

Object-Oriented Programming

Object-Oriented Programming is a technique that uses abstraction to create models based on the real world. These object models represent things that we are programming about. These objects can be data structures and can hold data in their attributes and these attributes can be changed through methods(functions) that belong to the other objects or the same object.

Conclusion

I mainly use JavaScript with React even though I’m a bit inclined to use TypeScript more lately. I started using class components then switch to functional components to use Hooks. I have used functional programming paradigm without actually knowing that I do, when I was creating my components and modules. It was the lowest hanging fruit and very suitable for my case.

Comparison between OOP and Func

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ali Erbay

Ali Erbay

7 Followers

Full Stack Developer BDD/TDD || Ruby on Rails || React || React Native || NodeJS || Express https://github.com/kermit-klein