5

I am no language expert but I'm recently into languages and trying to get an overview of major concepts and "their" languages. This is similar to another question about books. So first, what are the major programming language concepts, e.g.

  • structured
  • procedural
  • object orientated
  • object orientated - prototype based (e.g. Java Script)
  • functional (e.g. Haskell)
  • logic orientated (e.g. Prolog)
  • meta (if a pure concept of it's own?)
  • stack based (e.g. Forth)
  • math based/array oriented (e.g. APL)
  • declarative
  • concatenative (e.g. PostScript)
  • (definitely incomplete list...)

and second to get a good crasp of these concepts, what would be the programming language that's based on/implementing its core concept most naturally and pure?

  • For example Java is OO, but it's not a good example because it's not pure OO due to atoms.
  • Lisp is a known to be a functional language, but it's multi-paradigm, so it's not pure. But Lisp may be a pure implementation of "list-based" (if it counts as concept).
  • Is there a language that's structured (no GOTO) but not procedural? (Maybe XSLT v1.x)
Community
  • 1
  • 1
Peter Kofler
  • 9,252
  • 8
  • 51
  • 79
  • 1
    Smalltalk is not prototypal. SELF is. Also, a number of the "concepts" above are not orthogonal. One would have to talk about *specific aspects* of each language in comparison with each other (even the terms above may change meaning based on context/language). SQL is also "set oriented" (but a "declarative query language"), not table oriented :-) –  Nov 02 '10 at 22:37
  • @pst thanks, I removed the wrong examples. – Peter Kofler Nov 03 '10 at 19:45
  • 2
    By the way, thanks for not choosing Java as prime OO example. –  Nov 03 '10 at 19:59
  • Similar answer @ "Programmer": http://programmers.stackexchange.com/questions/1719/if-one-is-to-learn-a-new-programming-language-each-year-what-should-the-list-be/7389#7389 – Peter Kofler Jan 31 '11 at 17:00
  • possible duplicate of [What are important languages to learn to understand different approaches and concepts?](http://stackoverflow.com/questions/3958630/what-are-important-languages-to-learn-to-understand-different-approaches-and-con) – nawfal Jul 22 '14 at 21:51

3 Answers3

8

The term you're looking for here is "programming paradigm" and there are a whole lot of them out there. You can get a list of languages which support each from that Wikipedia page and its follow-up links.

For "pure" renditions of any of these, that's harder because it depends on what level of purity you're looking for.

  • For pure structured (under any sufficiently-loose definition of "pure" here) you can look, for instance, at Modula-2.
  • For pure object-orientation you're looking primarily at Smalltalk and its ilk if you want absolutely everything to be uniformly treated (not actually necessary under the most common definitions!) or you're looking at languages like Java and Eiffel if you'll accept primitive types under that heading.
  • For functional you're looking most likely at Haskell.
  • For logic programming the archetypical language is Prolog, but it's not really pure. The only (mostly-)pure logic language I know of is Mercury, and that only if you view its functional chunks as being essentially compatible with its logical chunks.

...and so on and so on. You get the idea.

JUST MY correct OPINION
  • 35,674
  • 17
  • 77
  • 99
  • +1 esp. for the Wikipedia link, hadn't seen it before. But the paradigms feel a bit low level to me, as there are usually serveral grouped together. Still a good beginning with procedural, OO, FP, Logic. Thanks. – Peter Kofler Nov 03 '10 at 19:43
  • I'd actually nominate Ruby over Smalltalk for pure object-orientation. Granted, Smalltalk was first here, but Ruby followed in its footsteps -- everything is an object in Ruby too (including literals and class definitions), and Ruby is more modern, more popular, and arguably easier to use. – Ben Lee Nov 03 '10 at 20:06
  • @Ben Lee Agree that Ruby is more pure OO but also has some functional aspects, Closures, map, Continuations, etc. Propably every modern language is multi-paradigm? – Peter Kofler Nov 04 '10 at 07:43
  • OK, this is going to be entertaining. Precisely in which way is Smalltalk less pure an OO language than Ruby? Give specifics, not hand-wavy generalities. – JUST MY correct OPINION Nov 04 '10 at 08:29
2

I think Pascal is the canonical procedural language.

I also think Lisp (ironically not ML) is the canonical "meta" language.

For one, a macro is a program fragment which modifies a data structure that represents a program fragment---so you use the language to tweak the language. Secondly, it's considered common practice to write self-hosting interpretors, traditionally called metacircular evaluators: they are programs which programs and run them.

Of course, any other language can do that. In Python you have access to the python compiler, and PyPy is a python implementation in python. But Lisp has, I think, the strongest tradition of doing this.

But I'm a Lisp outsider, so what do I know... 'hope-this-helps ;-)

Jonas Kölker
  • 7,680
  • 3
  • 44
  • 51
0

Thanks to JUST MY correct OPINION's answer I was pointed in the right direction. I will give the list of paradigms together with their pure languages as far as I found out till now:

  • imperative
    • non-structured --- early BASIC, Assembly
    • structured --- ?
    • procedural --- ?
    • modular --- Modula-2, maybe Pascal
    • object-oriented
      • class-based --- Smalltalk
      • prototype-based --- Self, maybe Java Script, Lua
  • declarative --- SQL, Regular Expressions, CSS
    • logic --- Mercury, maybe Prolog
    • functional --- Scheme, Haskell
      • tacit/point-free
        • concatenative --- Joy, Cat

On a different "axis" we have

  • scalar --- most of them
  • array --- APL

Don't know where to put it:

  • stack based --- Forth, Postscript
Peter Kofler
  • 9,252
  • 8
  • 51
  • 79