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

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.

  • 5
    And, of course, mainframe code from LONG before 1987 had "external symbols" (== "public") routines and non-external (== "private") routines, without the specific keywords. – Ross Patterson Mar 24 '14 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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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