8

The Question

What are the origins of the Public/Private function paradigm?

Background

A question came up in chat about Header files in C, and their usage being mainly to help the compiler, not the programmer. It's my understanding though, that this is the first usage of the concept of "Private" functions, or functions which aren't prototyped in the header file. Had C not used header files to declare functions, would we still have the current concept of Public and Private functions as seen in C# or Java? Or was this concept initially developed elsewhere and simply implemented in the C Header/Source scheme

2 Answers 2

10

Private/public comes from the original OO language, Simula, which predated C by a few years. According to the Wikipedia article, the original concept was first implemented in the TOPS/10 variant of Simula, and was integrated into the core language standard in 1987. It doesn't say when TOPS/10 Simula was first created, though, so it may or may not have been earlier than C.

Regardless, even if C and its header file system had not been around, modern programming languages would still have inherited the concept of encapsulation through the private/public system from Simula.

1
  • 5
    And, of course, mainframe code from LONG before 1987 had "external symbols" (== "public") routines and non-external (== "private") routines, without the specific keywords. Mar 24, 2014 at 22:10
1

I think the idea of making parts of your code private has roots which goes further back than Simula. Scheme (1975) was the first language to implement closures, which gives you the possibility to encapsulate data such as lambdas. Schema also lets you specify internal functions using the define keyword.

Making functions private allows more abstraction to be incorporated into a program. Building abstractions in programs has a long history, with LISP-variant languages such as Scheme contributing a lot to the development of modern programming languages.

Structure and Interpretation of Computer Programs by Abelson, Sussman is an excellent book to learn more about abstractions if you are interested in those things.

1
  • this post is rather hard to read (wall of text). Would you mind editing it into a better shape?
    – gnat
    Mar 26, 2014 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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