Chapter 4b CSC/ECE 506 Spring 2011 / ch4b
Programming Paradigms
Every computer program needs a style of writing which specifies how to solve a specific software engineering problem. This style is represented by the term paradigm. A computer program represented by a programming language specifies a set of variables, objects and methods to solve a computational task. This task can be modeled to a level of abstraction which makes the problem more comprehensible and easier to follow before actually implementing it in a particular language. This is what paradigm refers to and the levels of abstraction depends on the type of paradigm used. Different paradigms and the languages supported are: Procedural/imperative paradigms: Assembly, C, C++, Java, C# Object Oriented paradigm : C++, Java, Python, Ruby, Scala, C# Functional Paradigm : Lisp, Haskell, Clojure, Scala, OCaml, Ruby Logic Paradigm: Prolog [edit] Multi-Paradigm Programming
Multiparadigm refers to use of a combination of programming paradigms for solving a computational problem. Some languages subscribe strictly to a single paradigm like Assembly and C. Others like Java, C++, Scala and C# employ more than one paradigm. For example while C++ follows object oriented and imperative, Scala follows functional and object oriented concepts. Every paradigm comes with its own strength and weakness and this quite motivates us to take advantage of each paradigm and use it in a manner that best fits the problem at hand. In this chapter we will focus on functional programming mixed with object oriented concepts and analyze some example languages which implements this feature.