Take the 2-minute tour ×

If somebody has to start learning to program, where should he/she start? Should he start to write procedure-oriented programs or jump to OOP?

share|improve this question
programmers.stackexchange.com/questions/89453/… maybe this question will be interesting for you to know more about reasons behind OOP. –  deadalnix Sep 8 '11 at 12:07
You can take a hint from MIT and start with learning SICP/Scheme which is mostly functional. –  dietbuddha Sep 8 '11 at 16:56
add comment

8 Answers

up vote 13 down vote accepted

The best thing you can do is to get a handle on all the paradigms. I'd suggest the following order:

  1. Simple procedural programming: just getting basic sequential programming techniques down.
  2. Structured programming: Top-Down design, Abstract Data Types, Modules.
  3. Functional Programming: Working without side-effects, functions as first-class objects
  4. Object-Oriented Programming: Abstraction, Polymorphism
  5. Very low-level programming, i.e. assembly language: working with the hardware, number of registers, cache, memory, SIMD instructions, optimization, and generally an appreciation of how much easier compilers and interpreters make our jobs.
  6. Multiparadigm-programming: Combine all of the above using the best tool for the job when appropriate

And then you can try some more esoteric styles, such as Logic Programming (Prolog), and Concurrent Programming (Communicating Synchronous Processes, OCCAM).

You can several steps in one language (Python would cover most of the bases), though it's probably better to do 3 in a relatively strict functional language (I'd suggest Lisp), and 4 in a relatively strict OO language (Java, C#). You don't have to go extremely deep in any of the languages, just do a Code Kata or two in each to get a feeling for the paradigms.

Having all (or just several) of them under your belt will make you a more versatile programmer, even if you never really go deep into one specific paradigm again.

share|improve this answer
Generally a very good answer, but solving a problem or two in Java or C# won't teach you object oriented programming. It takes years to become a good OO-programmer/designer and to truly understand it. –  Falcon Sep 8 '11 at 12:59
+1. Although I must say inheritance is to OOP what hats are to carpentry. There's no particular reason why C couldn't have single inheritance for structs for example. –  back2dos Sep 8 '11 at 13:02
@Falcon - true, but OOP is the most likely "professional" path out there, and thus likely to be covered deeply at a later time. I'd much rather see more well-rounded developers that I can teach good OOD (not OOP) than "OOP for everything!" people. –  Joris Timmermans Sep 8 '11 at 13:04
@back2dos - you're right, inheritance is an implementation detail, it's polymorphism that matters. I'll edit my answer. –  Joris Timmermans Sep 8 '11 at 13:05
@MadKeithV: I fully agree with everything you said in your answer, I just felt I need to mention it for the reasons deadalnix posted in this answer. Anything in your list can be understood and used pretty quickly, but most novices fail to understand and use object orientation correctly. –  Falcon Sep 8 '11 at 13:19
show 3 more comments

I think what you begin with isn't really important. What is important is that you know both, and fail with both.

Because you will fail. Learn from it.

All xOP are here to solve problems devellopers encounter when coding, or maintaining software. The bigger the software is, the more important it is. You can learn OOP, or POP, but at the end, you'll not understand what it is good for unless you exprience problem you have not following those methodologies.

POP, OOP and others are not just coding techniques. This is a way to think about your code. New way to think are devellopped to solve problems devellopper had with previous way to think about what they do.

Acquiring that require time, way more than learning simple techniques.

Anyway, I'll advise you to start with POP. Because at the end, you cannot do something without it. If you do OOP, you'll have clases, methods, but with methods, you'll find plein old procedural programming.

POP and OOP are not think that should be thinked at instruction level. At this point, you are doing procedural, even if you do OOP, fucntionnal, or whatverer. But doing only POP, you'll encounter problems when your software grows. OOP, functionnals, and others way of thinking your software as a whole will help you to handle the incrasing complexity of the code.

Note that thos can be achieved in pure procedural, but kinda hard, and not the way broadly used in industry.

share|improve this answer
add comment

I think that before you start doing oop programming you should have a basic understanding of programming as it used to be done. It's important for a programmer to know why he/she is using oop and i think the fastest way to understand this is by starting without, begin with the basics of memory manipulation and math.

share|improve this answer
I second doing it the historic way. But then, he should learn also functional programming between POP and OOP. –  Ingo Sep 8 '11 at 12:27
You seem to be saying "as it used to be done" as if it's a single (procedural) style. It's not. There's more to programming than procedural vs OOP. –  Joris Timmermans Sep 8 '11 at 13:07
add comment

I suggest a simple, non-obstructive environment such as Squeak or Ruby with Shoes.

There's no reason to start programming in a procedural manner. Neither coding closer to the computer nor re-enacting the history of programming will help you find a good entry point to programming.
When you first learn, how to drive, you won't do it in a steam engine, although it's historically correct and will help you actually see on what basic principles engines are based.

First learn how to do it, gather some intuition and then push forward for an ever deeper understanding.

share|improve this answer
add comment

I'd say go for learning both. If you don't know how to program yet, close your eyes and choose Python as your first language. It allows you to put in your procedural concepts while still being object oriented. Even using standard Python libraries/types will give you a feel of OOP and you will excel in the Science and Art of Programming. Then once you get the feel of the language itself, go for OO concepts.

Once you have the concepts right, you can give C++ or even Java a shot. But as a complete beginner, I'd recommend Python first.

OOP, Procedural programming, etc are just different ways to model and solve problems, and you should definitely have both under your belt.


Yati Sagade

PS: the second person in the above answer refers directly to the third person in your question :)

share|improve this answer
add comment

I would reccomend OOP first, here's why:

First Language

You want to start off with OOP. The reason is that this is primarily what is used in the real word, and you it's always easier to learn a concept like that as a first language, instead of a second one. I always hear people saying they don't understand the concept of OOP, theses are usually POP programmers that are transitioning to OOP. My first language was Java, which is an OOP programming language, and I never had a problem understanding the concept, because I didn't know anything else.

OOP can do everything POP can do

The other thing is that you can always use an OOP language as a POP if you want to. for example, in java, you don't have to use more than one class if you don't want to, and it becomes fairly easy to understand what POP is like (OOP has all of the features of a POP language, but it is more dynamic and reusable, but if you don't want to, you don't necessarily have to take advantage of those features) the same should apply with something like C++ vs C

share|improve this answer
-1. For one Java is a poor choice for OOP and secondly, you cannot do everything in Java you can do with C. Not even half of it. –  back2dos Sep 8 '11 at 13:00
but you can do everything from C in C++ which is also OOP –  Ephraim Sep 8 '11 at 13:07
@back2dos, why is Java a poor choice for learning OOP? And why is it a factor in learning to program that one should be able to do "everything" (how you define "everything" btw?) in his/her first programming language? –  Péter Török Sep 8 '11 at 13:07
@Péter Török: I never said one should be able to do everything. However Ephraim claimed, that you are able to do it and that's plainly wrong. Java is a poor choice for learning OOP, because in Java OOP is optional. –  back2dos Sep 8 '11 at 13:45
@back2dos: Have you ever programmed in Java at all? Java is based primarily on the object orientation paradigm. –  Falcon Sep 8 '11 at 13:51
show 5 more comments

There are many ways to Rome, but one approach that strikes me as logical is to follow the evolution of programming languages and paradigms. So you'd start out with a close-to-the-metal imperative language (probably C). Then you'd build from there, discovering abstractions that people have invented to make managing complex code easier. So:

  1. Imperative
  2. Structured
  3. Structured, but avoiding global state
  4. Functional or OOP
  5. OOP or Functional
  6. ad libitum: Logic Programming, Aspect-oriented, Data-driven, Metaprogramming

And of course, taking the best of each in real-world programming situations.

At the bare minimum, I think a decent programmer should have had some exposure to at least one language in each of the following groups:

  • C
  • C++, Java, C#, Objective-C, ...
  • Python, PHP, Perl, javascript, ...
  • Lisp, Haskell, ML, Scheme, Clojure, F#, ...
  • brainfuck, malbolge, befunge, intercal, ...

(I'm serious about that last category: while you won't do any serious programming in any of them, looking into them definitely gives insights into the way computers and the human mind work)

share|improve this answer
add comment

This question is a bit like asking men if they think being circumcised is better than not being circumcised - there seems to be a remarkable correlation between whether or not they are circumcised and whether or not they think it's better. Of course, once you've been circumcised it's hard to go back. ;-)

As someone who first learned procedural programming, I (and quite a few of my peers) initially struggled at first with OOP. Having spoken to people whose first experience with programming was OOP, it seems they found it a much more natural way of working. This may be because they weren't trying to make it fit with their pre-existing procedural approach, trying to impose it, if you will. Or it may just be that they were smarter than me and my friends (very likely).

share|improve this answer
add comment

Your Answer


