Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-Paradigm Languages

Tags:

In a language such as (since I'm working in it now) PHP, which supports procedural and object-oriented paradigms.

Is there a good rule of thumb for determining which paradigm best suits a new project? If not, how can you make the decision?

like image 937
Thomas Owens Avatar asked Aug 06 '08 21:08

Thomas Owens


People also ask

What do you mean by multi-paradigm language?

multi-paradigm (not comparable) (computing, of a programming language) Supporting more than one programming paradigm, in order to allow the most suitable programming style for a task.

Is C++ a multi-paradigm language?

C++ is a multi-paradigm language that lets you solve a problem in different ways, and this course will teach you the best practices. Furthermore, C++ has been re-invented again. C++2a is the largest extension to the language since C++11, and it almost feels like a new language.

Is Python a multi-paradigm language?

Python is a multi-paradigm programming language. Object-oriented programming and structured programming are fully supported, and many of its features support functional programming and aspect-oriented programming (including metaprogramming and metaobjects [magic methods] ).

Is Java a multi-paradigm?

Some languages are designed to support one paradigm (Smalltalk supports object-oriented programming, Haskell supports functional programming), while other programming languages support multiple paradigms (such as Object Pascal, C++, Java, JavaScript, C#, Scala, Visual Basic, Common Lisp, Scheme, Perl, PHP, Python, Ruby ...


1 Answers

It all depends on the problem you're trying to solve. Obviously you can solve any problem in either style (procedural or OO), but you usually can figure out in the planning stages before you start writing code which style suits you better.

Some people like to write up use cases and if they see a lot of the same nouns showing up over and over again (e.g., a person withdraws money from the bank), then they go the OO route and use the nouns as their objects. Conversely, if you don't see a lot of nouns and there's really more verbs going on, then procedural or functional may be the way to go.

Steve Yegge has a great but long post as usual that touches on this from a different perspective that you may find helpful as well.

like image 76
Chris Bunch Avatar answered Oct 11 '22 02:10

Chris Bunch