+ 2

What are Programming language​ paradigms ????

I want to talk about this topic if any one have any little bit information about this topic so give me some explanation ??

3rd Jun 2017, 5:11 AM
Aijaz Ahmed
Aijaz Ahmed - avatar
2 Respostas
+ 2
Main ones are Imperative (essentially, purely coding), Functional (no state, functions are first class citizens), and Object-Oriented (objects with state and methods). I'll explain more in the morning if I remember to get back to this...
3rd Jun 2017, 6:58 AM
Jason Runkle
Jason Runkle - avatar
+ 1
Programming paradigms are basically different ways to structure your code so that you can think about it more clearly. Think of it like a strategy for Programming. In Imperative programming, you don't really follow a special strategy so much as write a simple flow of code that performs some task. Almost all of the tutorials on this site demonstrate Imperative programming. You can think of this as Programming pure and simple and it is the foundation of the other paradigms. In Functional programming, functions are the main focus. You pass functions to other functions, returning the results of one function into another, generating new functions when you needed them. In general, this style prefers functions that have no side-effects, meaning the functions don't cause anything else to happen on the side beyond getting their output. It's really useful for doing things with a collection of items (such as filtering a list) and really fits well with parallel processing (doing many operations at the same time on all members of a collection for example). In Object-Oriented programming (OOP), the focus is on objects. Objects have state (variables that describe the properties of the object) and methods (things the object can do - possibly to other objects). For example, if we model a Car as an object we might say it had various properties such as gas, speed, number of doors, etc and various methods such as accelerate, stop, fill gas tank, etc. The nice thing about OOP, is that you trust the objects to know how to do the things they need to do. The main program doesn't need to handle the special cases, the objects can do it for themselves. This is especially important if you have different behaviors for the same action. Like a truck needs to use more gas, but it can pull more weight than a Toyota Corolla. They both drive, but they have different capabilities. Hope that helps, ask more questions if you need more specific advice.
3rd Jun 2017, 3:01 PM
Jason Runkle
Jason Runkle - avatar