Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm in the 4th year at an IT university now, and when I talk with my professor about this topic he rejects my opinion and gives me a very heavy criticism (in my university, we were being taught C (ANSI) (in Procedural Programming class - in the 1st year at university ) before C++ (in OOP class in the 2nd year) and others...

But at age 13 my brother was taught, by me, Java first and nothing else. Now, he can do almost everything which a normal 2nd-year-student can do with Java.

To you pros, I'd like to know why you think we should be taught procedural programming first.

share|improve this question

migrated from stackoverflow.com Mar 23 '11 at 3:19

This question came from our site for professional and enthusiast programmers.

closed as primarily opinion-based by MichaelT, gnat, GlenH7, m3th0dman, Eric King Apr 21 at 19:55

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

Because Assembler doesn't have objects. –  Mimisbrunnr Mar 23 '11 at 2:40
It's like why we should be taught to calculate properly before learning how to use a calculator. –  shinkou Mar 23 '11 at 2:47
Because object oriented design is flawed. Programs are a collection of behaviors that operate on data. Objects often introduce unnecessary complexity. Read "How to Design Programs: An Introduction to Programming and Computing". –  juxstapose Mar 23 '11 at 2:47
As put by someone else, "Don't distract new programmers with OOP": prog21.dadgum.com/93.html - basically all that OOP is getting in the way of teaching new programmers the fundamentals. You're teaching them two really difficult concepts at the same time. –  John Ripley Mar 23 '11 at 2:54
@juxstapose - saying object oriented programming introduces unnecessary complexity is like saying we should carve vehicles from a single block of steel. Just my opinion. –  Spacemoses Mar 23 '11 at 2:56

12 Answers 12

Quick Summary:

  1. Because in real world, sooner or later, you have to work with procedural code.

  2. Because Procedural Languages can work like an extension, or an introduction, to Object Oriented Languages, instead of just been an alternative.

  3. Complement to answer 2. Because O.O.P. is more complex than Procedural Programming, therefore its better to learn Procedural Programming, first.

  4. Because in real world, programmers work with, and combine several ways to solve problems, A.K.A. "multiparadigm programming", not just a single paradigm.

  5. Most programming languages are multiparadigm, at some level, even, if their designers or common developers, say the opposite.

  6. [NEW] Because Modular Programming who is commonly mixed and confused with Procedural Programming, can be applied to O.O.P. Therefore the question may be read as "Why must we learn Modular programming before we learn Object-oriented programming"

Extended Boring Description:

Point 1 is very clear, not further explanation.

Point 2, Classes, Inheritance, Polymorphysm, Interfaces, so on...

Point 3, I code Procedural Pascal before I learnt Object Oriented Pascal, when I got there I said: "look, classes are like small procedural programs... ...and you can make them talk to each other, cool !!!".

I heard the same from people who went from plain C to C plus plus.

Point 4, Most of times programmers combine several programming techniques or paradigms, or ways to solve a problem. Functional, Procedural, O.O.P., logical.

Even Java "Pure O.O." is not as plain object programming as it says.

+1 point fo saying "Procedural Programming" instead of "Structured Programming". Or Modular Programming. These is important.

Altought, many times these terms are teach toghether and used interchangeably, they're not. Structured Programming, include many concepts, not just using procedures, and one of them is making program not to look like "Spaghetti Code".

Today I read several "pure" O.O. programs that look like "Object Oriented Spaghetti Code", meaning that the programmer used O.O.P., but its code looks like a mess.

Many times, I can read a O.O. code and tell that the programmer learnt Structured Programming before O.O.P., because the code is clear and arranged.

And for Modular Programming, I have seen several apps. in C++ and PHP that doesn't use modules.*

share|improve this answer

The guts of OOP objects are made up of procedural programming.

If you can't do a for loop, use pointers properly, declare your types and functions you won't be able to write interfaces for your classes much less make the insides do anything worth doing.

You really wouldn't be learning OOP in a introductory class anyway, it would just be syntax - jumping straight into OOP would make things more complicated to grasp (at first) than it already is.

OOP isn't about some declaring syntax to form classes, it's about data structures, design patterns, polymorphism, inheritance, and composition.

To do all of those things you need to know procedural programming, something easily done in C. You can carry most everything you learn with C over into Java or C++ anyway, you may have to rethink some things you took for granted in C, BUT... You gotta know the grammar (where you're at in introductory C) to write sentences (must write procedures to define interfaces) then paragraphs (gotta know data structures) then and then know some design patterns (tragedy, comedy, flawed hero, how they interact; and when not to use them) before you can write complete novels (complete OOP system).

If I were you I'd pick up some of the following books: The C Programming Language, The Java Programming Language, Design Patterns, Gang of Four, and Pattern Hatching. I would definitely pick up a copy of The C Programming Language if I was serious about C/C++.

If you just want to go all the way Java (and doing it for the $) id pick up some books on Java design patterns and how to use Java with the Apache and Tomcat web servers and some books on SQL database programming. Java kicks so much ass on the web, I'm sorry but PHP has had a history of tons of security holes making it as much as a pain in the ass as Windows to keep from getting your server rooted or you SQL databases injected.

You should also take the time to learn SQL, Oracle MySQL Postgresql and MSSQL have much in common regarding syntax but if I had to just pick learning one for myself id pick Postgresql just because it's BSD licensed instead of GPL (you should look up a compare and contrast on GPL / BSD licenses too)

share|improve this answer

You don't.

We learned functional programming first, with Scheme. Then we moved to procedural, then OOP, and then declarative programming. And believe it or not, while I already knew programming, I think it was actually easier for other people as well: because FP is just like math! So you know the basics already.

I've debated this with myself many times, and I've ultimately come to the conclusion that it really depends on how well your teacher teaches you the concepts.

There's no single answer because:

  • Starting with something procedural like C (or even assembly) might be a good choice, because you learn how computers really work

  • Starting with something object-oriented Java might be a good choice, because it's relatively easy to learn and apply OOP to real life, and because it teaches you about **forming

  • Starting with functional programming like Scheme might be a good choice because it teaches you about thinking more abstractly (in terms of functions instead of variables), which ultimately makes you a better programmer

If your teacher doesn't teach it well, then it doesn't really matter what you start out with; they'll pretty much turn out the same.

share|improve this answer
+1 bang on and I can't believe I had to scroll through so many poor answers to find it! –  jk. Feb 1 '12 at 8:46
I actually had trouble grokking math functions for a while cause i had learned some coding first, and the concept of a function that 'is' instead of 'doing things' baffled me. :3 –  StarWeaver Oct 3 at 0:35

Several others have already answered along this theme, but I think it's worth stating this more explicitly.

Even if you begin learning programming with an object-oriented language like Java, you start by learning procedural programming techniques before you get to the OO concepts. When teaching a new programmer Java, you don't introduce them to objects and classes first, you introduce them to statements and variables. By the time the student is in a position to be taught much about objects and classes, they already have at least the basics of procedural programming.

So at the least, you have to learn procedural programming in Java and then learn object-oriented programming in Java. Whether you spend a whole year on procedural programming or you just spend the first few weeks of the programming course, and whether you use a different language for it or not, is just arguing about the details.

share|improve this answer

There is no reason other than institutional inertia. Look at CMU, they threw out their entire OOP curriculum and replaced it with functional programming. So once again, the answer to your question is that it is an arbitrary choice made by the administrators of whatever school you are attending. In case anyone is wondering about the factual statements I've made here is the post about changing the curriculum at CMU by one professor/administrator: Teaching FP to freshmen.

share|improve this answer
-1 misleading - while I did see a thread (via google search) that claimed that CMU dropped OOP from their first-year CS curriculum and replaced it with functional programming, the official CMU curriculum starts with the Alice programming language, which is object-oriented [see enr-apps.as.cmu.edu/assets/SOC/CS_SPRING.htm] –  Steven A. Lowe Mar 23 '11 at 5:24
@davidk01: (1) factually incorrect assertion in answer. (2) "Alice is a freely available teaching tool designed to be a student's first exposure to object-oriented programming" from alice.org –  Steven A. Lowe Mar 23 '11 at 6:16
@Steven A. Lowe: Straight from the horse's mouth: "Object-oriented programming is eliminated entirely from the introductory curriculum, because it is both anti-modular and anti-parallel by its very nature, and hence unsuitable for a modern CS curriculum. A proposed new course on object-oriented design methodology will be offered at the sophomore level for those students who wish to study this topic." - Teaching FP to freshmen –  davidk01 Mar 23 '11 at 17:33
@davidk01: excellent link, thank you. From the committee paper cited in that article "Although object-oriented programming (in its myriad forms) remains a dominant theme in industrial software development, the use of object-oriented languages, such as Java, at the introductory level introduces considerable complexity and distracts from the core goals at the introductory level. It seems preferable to give fuller coverage of OO design and implementation methodology to later in the curriculum to allow more focused concentration on basics at the introductory level." [emphasis mine] ... –  Steven A. Lowe Mar 24 '11 at 2:31
@davidk01: I'm happy to agree to disagree. Call me pedantic if you like, but to me there's a significant difference between changing the introductory level emphasis and "threw out their entire OOP curriculum". I'd hardly call reducing the scope of the introductory classes a "sweeping change" ;-) –  Steven A. Lowe Mar 24 '11 at 3:05

I would have to say that most code written in object-oriented languages like Java isn't actually object-oriented. Really understanding the ideas behind OO is hard, as a result most supposedly OO code is really mostly procedural.

However, this is nothing really wrong with writing procedural code in Java. Yes, there are benefits to doing OO, but its not something I'd want to confuse a beginning programmer with. So on that basis, I see nothing wrong with teaching Java. Don't expect real OO from it, but it works.

However, Java hides a lot of the low level details about what is going on inside the computer. C leaves these much more out in the open. One can make a good case that students should learn how these low level details work before using a language that takes care of these for them. But you can also make a case that you should ignore those details and learn them later.

share|improve this answer

Procedural programming, at least in a language like C, strips programming to a very bare bones practice: algorithms and data structures, and at a level of abstraction that's a happy medium between human understandable source code and assembly code.

In this way, students can learn a bit of science (algorithms, data structures) and a bit of engineering (source->object->machine compilation, von-neuman (likely) architecture) at the same time.

OOP, via C++/obj-C introduces a code organization pattern, which is just one more thing to learn. This could make learning the concepts above somewhat more difficult.

OOP via Java (amongst others) goes even further by abstracting away hardware and environment. Now the underlying product isn't machine code, but some sort of intermediary that doesn't reveal how the underlying hardware works, but the effect is that it allows the student to concentrate on code organization patterns.

In the end I think it's a trade off between learning how the hardware works or learning a code organization pattern. As for which is more important, I don't really know. The real world requires knowledge of both, at least to some degree.

I'm going to guess that an undergraduate program that starts with low-level procedural programming likely produces computer scientists / computer engineers, and a program that starts with higher-level concepts produces software engineers / developers / programmers.

share|improve this answer

Two reasons for me: One OO programming came to solve problems of procedural programming. So by writing some procedural coding and then same things in OO, makes it easier to understand the difference.

There is also an additional element here: The two approaches to educate on Programming topics. One can start with as low as it gets (example assembly, in many places procedural, some others start with circuits) and then go up (towards OO/Functional/Managed). The other approach is to start from the physical world (eg. Browser/Windows 7 etc) and then start to go deeper. There are pros and cons to each approach. Your university chose the first and to start with procedural. There might be some rationale or they just copied someone else :-).

share|improve this answer
"OO programming came to solve problems of procedural programming." That was the goal, but OO created as many problems as it solved. –  bit-twiddler Mar 24 '11 at 1:46
@bit-twiddler: Very big story. Focusing on (or narrowing it down) on the pedagogical aspect, it makes a case: What we had this, how we made it better: that (you argue on if it's better or not) –  dimitris mistriotis Mar 24 '11 at 9:23

A language may be object oriented like C++, Java or C#. And you can start with these languages. But the point is, even with these OO languages, you have to learn the procedural programming first, then OOP. I think, the same was done by you to your brother.

share|improve this answer
+1 Precisely. Every OOP method is a short procedural program. If you don't know how to combine the small pieces (types, literal values, variables, operators, = assignment, if, for, etc) into bigger pieces (methods), how can you ever hope understand OOP. As with most skills, being very smart, motivated, and/or having access to one-on-one instruction can allow you to learn multiple, related topics simultaneously. –  David Harkness Mar 23 '11 at 7:53

To be overly blunt about it, I think the momentum for this comes primarily from old programmers wishing for old times.

Before saying anything else, I absolutely do not hold any contention for older programmers, many many of them are simply amazingly skilled. Unfortunately sometimes those who aren't, who become washed up and never really were truly good at programming to begin with..become professors when they can't hack it in the 'real world'. (Not all professors either...but...MANY)

OOP is not the holy grail of programming it is made out to be, neither is procedural programming a relic. It's good to know at least some of both, but I think the general practice of what ends up being taught as procedural programming tends to be a giant waste of time and effort. We need to learn programming in academia, not just one style or the other. I attribute quite a bit of terrible code and misconceptions to this, including my own.

share|improve this answer
I had a teacher using C from '89, but it was for a microchip expecting c '99. Then there was that other teacher using 'c++' but without the STL or templates. Might as well have been structs with function pointers in them. –  Ape-inago Mar 23 '11 at 10:53
To be fair, the STL and templates in general are not introductory C++ topics. The basic goal of any 101-level programming course is to teach how to create well-structured sequential, conditional, and iterative logic within the constraints of a given syntax. All of the other language features are merely syntactic sugar that allow one to group the basic control structures as well as bind them to data. –  bit-twiddler Mar 23 '11 at 20:23
ouch two downvotes. saw that one coming =P strange to me though as the opinion originally came from an older programmer who helped me recover from poor teaching. @Ape: The head of our CS dept was trying to teach us COBOL for a year back in 2004 XD (the least of my worries from his 'teaching' style, I kinda don't mind since I can work on some Point Of Sales machines lol but geeze...seriously?) –  Garet Claborn Mar 23 '11 at 21:40
@bit-twiddler - Aye sir, very strange. I don't rely much on that experience much in this opinion, but I have looked into other locales. I really love both styles of programming and seems to me they should teach them together. I just find that the even slightly younger professors don't have the same percentage of zealotry about the issue. IMO that's a good thing. I understand some think procedural first is important. –  Garet Claborn Mar 24 '11 at 5:28
@bit-twiddler : yeah, but it wasn't an introductory course. It was a 4th year advanced course in database design, and we were supposed to be using c++. It just felt wrong after experiencing c++ to such a high level with previous courses. –  Ape-inago Mar 24 '11 at 19:40

Object-oriented programming is a collection of procedural snippets in an organized fashion. I think the lesson you are learning is that object oriented methodology helps maintain organization and maintainability. There are a lot of programmers who cannot make this distinction and will claim their programs are object oriented when they are more procedural.

share|improve this answer
but functions+state=objects –  Dan D. Mar 23 '11 at 2:58
Object orientation often makes maintenance much more difficult because it inflates the code base. Java-based systems are a nightmare to maintain because of the level of OO purity and design patternitis found in that community. –  bit-twiddler Mar 23 '11 at 3:32
"Design patterns found in that community" - sounds like a personal problem in the "Java community" if that is your stance. –  Spacemoses Mar 23 '11 at 4:16
@Dan D: object orientation is much more than combining functions and state in an object... –  Marjan Venema Mar 23 '11 at 10:57
@Spacemoses: I have a problem with any development community that does not embrace the KISS principle. The best solution to a problem is often the simplest solution. –  bit-twiddler Mar 23 '11 at 20:14

I would think that the analogy would be similar to math. You need to learn some basic concepts first (addition/subtraction/...) then move on to more complex topics (algebra/calculus). Procedural program is very linear and it's easier to grasp the flow of control while you're learning the syntax. OOP is perhaps thought to be more complex, it builds on the simpler constructs used in procedural languages but is more abstract and harder to understand. Starting out with languages such as C also puts you closer to the hardware and makes you deal with issues of memory allocation and pointers, which you do need to understand but don't really get to use in languages such as Java/C#. There's some real value in being exposed to this in school regardless of whether it comes first or second.

FWIW, it's bound to change eventually. When I started school we learned in Pascal and PL/1. We didn't get to C until the advanced languages class (that dates me). I didn't pick up Java until graduate school -- it hadn't been invented yet!

share|improve this answer
+1 - kind of a paradox of intention there..."more abstract and harder to understand" :) –  Spacemoses Mar 23 '11 at 2:50
@Spacemoses - not really, the more abstract something is, the easier the discussion but the harder it is to grasp the reality of what is being discussed. –  Mimisbrunnr Mar 23 '11 at 3:08
agreed, i see your point now. –  Spacemoses Mar 23 '11 at 4:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.