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.

What design and implementation issues did programmers have to solve when they decided first to use structures and classes?

When did this happened and who were the pioneers behind these ideas?

Note, this is double question, because structures and classes are related. I realize that structures are quite older than classes. It would be great if the answer would talk separately about both of them and cite some sources.

share|improve this question
They aren't as related as often thought, and the issue is muddied by the fact that C++ implemented classes by laying syntactic sugar over structs containing function pointers. To further muddy the waters, C++ expanded structs to include actual method definitions and then making the struct keyword optional when the struct is used. –  Steven Burnap May 18 '12 at 16:56
The history contest isn't for another two days. :) –  chrisaycock May 18 '12 at 17:53
Thank you everybody for answers. The answers that mention IBM 1620, COBOL, Simula 67 and Giorgio's pedagogical explanation of principle create all the core of what I accept as answer. –  xralf May 18 '12 at 19:37

4 Answers 4

up vote 5 down vote accepted

The idea of a structure is to group together a collection of variables into a single container. E.g. if you have three coordinates

int x;
int y;
int z;

you might want to see them as a unit of data and group them together:

struct point
    int x;
    int y;
    int z;

You can see this as a way to modularize your data. Now you can define variables containing all three values in one unit:

struct point p1, p2;

In procedural programming, you have procedures or functions that manipulate data and, in particular, structures, e.g.

void shiftX(struct point *p, int offset);

You can call the function on a struct by passing it as an argument:

shiftX(&p1, -10);

The step from structs to classes is to say that procedures / functions should be grouped together with data into units: like structs classify entities that have the same structure, classes classify entities that have the same structure and operations.

So now you can write:

class Point
    void shiftX(int offset);

    int x;
    int y;
    int z;

and then:

 Point p;



In this way it is easier to group together operations that work on the same kind of data. E.g. you can group together all operations that act on points in the class definition, instead of having them scattered over your code as functions that have one or more parameters of type point.

Additionally, you can refine both structure and behaviour by using inheritance.

Summarizing: structs are a concept that allows to organize / modularize data. Classes allow to organize / modularize both data and operations.

share|improve this answer
I like the pedagogical approach of this your answer. So, if I understand it right I can learn more about this idea when reading something about Simula 67 as WorldEngineer writes and maybe somewhere will be written why this idea became popular between other programming languages. –  xralf May 18 '12 at 19:33
The idea became popular because it's an excellent way of organizing code. Applications have gotten progressively larger and more complex. Some operating systems have over 100 million lines of code. While a fairly poor measure actual complexity it does require massive organizational efforts. –  World Engineer May 18 '12 at 19:44
The alternative is to use modules (Modula-2), or packages (Ada, Java, Scala, etc), or units (some Pascal dialects). In this way you can group types and operations together. However, classes offer a tighter integration between data and operations, and additional features like inheritance. –  Giorgio May 18 '12 at 19:51
@xralf: Maybe reading about Simula 67 you can find out more about the motivations for OOP. BTW, as far as I can remember, Simula 67 has virtual methods already. So virtual methods are a really old invention. –  Giorgio May 18 '12 at 19:55
@WorldEngineer I thought that operating systems are written in Assembly and C language and there are libraries for code organization. –  xralf May 19 '12 at 15:39

Structures are groups of data, typically typed. COBOL saw the first widespread usage of them. Though analogs to that existed beforehand. The design issue here is grouping multiple sets of data together like a name, a occupation, and a phone number. The idea of a "record" is something much older than computing and shows up in mathematics and a host other disciplines.

Object Oriented Programming was originally designed to deal with simulation where you'd have a bunch of objects running to simulate a system. Simula 67 was the first to implement that style of programming. Smalltalk was the first fully object oriented language where everything is an object including primitives. The original issue being solved was the simulation of complex systems. Simula 67 was designed by Ole-Johan Dahl and Kristen Nygaard. Alan Kay (who once answered a question on Stack Overflow) designed Smalltalk which is still used.

Structures and Classes are related fairly closely to types in that they both define certain parameters for a set of data. Classes take it further defining access permissions and operations thus allowing fully implemented Abstract Data Types. Structures can be thought of a subset of Classes in an object oriented language. They'd be a wrapper class that has all the fields set to public and no methods outside of getters and setters for those fields.

share|improve this answer

You can find information on structures in this Wikipedia article. In short they seem to be so deeply anchored in computer science, that they were supported first by hardware (special instructions in IBM 1620, punch cards basically as one record instance, and Babbage's Analytical Engine (at least according to wikipedia). COBOL was the first widely used language to support the construct.

share|improve this answer
I like this explanation for structures. –  xralf May 18 '12 at 17:52

"structures" are actually completely different from "classes". Think of the old style "struct" as a record. In QBASIC they were even called that. The necessity of this is pretty obvious and though I can't say who invented it...I'd imagine it came up almost immediately. OOP "classes" seems to have fairly well started with Simula: http://en.wikipedia.org/wiki/Object-oriented_programming#History

share|improve this answer
In terms of intent, yes, but if you are talking about C++, the only difference between a struct and a class is that class defaults to private while struct defaults to public. –  Steven Burnap May 18 '12 at 16:51
Records date back to at least the 1800s, which slightly predates C++. I don't think C++ is relevant here. –  Jörg W Mittag May 18 '12 at 17:24
@JörgWMittag: I believe you, but got any sources or examples for that? –  FrustratedWithFormsDesigner May 18 '12 at 18:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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