-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new blog post: “Classes are a Dumping Ground [...]”
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: Classes are a Dumping Ground for Language Features | ||
description: When classes are the only structuring mechanism, they tend to accumulate features | ||
tags: programming | ||
... | ||
|
||
I am currently reading Benjamin C. Pierce's [Types and Programming | ||
Languages](http://www.cis.upenn.edu/~bcpierce/tapl/) (2002), and in chapter\ | ||
18 -- on imperative objects and classes -- he offers an off-hand comment about | ||
why the class features in most OOP languages are so complicated. | ||
|
||
As someone who have spent countless hours writing C++ (and to some extent, | ||
Java), this immediately jumped out at me: | ||
|
||
> The class mechanisms in real-world object-oriented languages tend to be | ||
> complex and loaded with features---`self`, `super`, visibility annotations, | ||
> static fields and methods, inner classes, friend classes, annotations such as | ||
> `final` and `Serializable`, etc., etc. | ||
|
||
> The main reason for all this complexity is that, in most of these languages, | ||
> classes are the *only* large-scale structuring mechanism. Indeed, there is | ||
> just one widely used language---OCaml---that provides both classes and a | ||
> sophisticated module system. So classes in most languages tend to become | ||
> dumping ground for all language features that have anything to do with | ||
> large-scale program structure. |