# Tag Info

60

Simula 67 is generally considered the first object-oriented language and predates Smalltalk by a number of years. It also used the this keyword for the same concept, which can be seen in this book chapter extract: class Linker; begin ref(Linker) Next, Sex, Employment; text ID; procedure Add_to_List(LHead); name LHead; ref(Linker) LHead; ...

24

Upcasts always succeed. Downcasts can result in a runtime error, when the object runtime type is not a subtype of the type used in the cast. Since the second is a dangerous operation, most typed programming languages require the programmer to explicitly ask for it. Essentially, the programmer is telling the compiler "trust me, I know better -- this will be ...

16

There are four main approaches, though these only scratch the surface of what is available: via lambdas and records: the idea is to encode objects, classes and methods in terms of more traditional constructs. Benjamin Pierce's work from the mid 90s is representative of this approach. Abadi and Cardelli's object calculi (see Abadi and Cardelli's book A ...

13

So what is the equivalent for object oriented languages? Lambda calculus. I mean, there is Cardelli's object calculus (and a handful of derivatives), but in general, there's nothing fancy about object oriented languages that requires a new approach to computation. It's well known (see TaPL for example) how to extend/encode Records and Mutation (and sub-...

12

The connection between object model core and set theory is described in the following documents: Object Membership: The Core Structure of Object Technology Object Membership – Basic Structure What Is a Metaclass? The documents present the structure of instance and inheritance relations between objects. Such a structure can be considered the highest ...

11

Overloading is when two or more methods have the same name but different signature (different argument types, different number of arguments). Overloading is resolved statically, depending only on the static types of the arguments. (The interaction of overloading and overriding, in Java, for example, makes the story a little more complicated). Overloading ...

10

You can take a look to (and cite) the book "Object-Oriented Analysis and Design" by G. Booch: ... An object is an entity that has state, behavior, and identity. The structure and behavior of similar objects are defined in their common class. The terms instance and object are interchangeable. We will consider the concepts of state, behavior, and ...

9

In a procedural language you can't necessarily express restrictions that are required to prove that the caller is using a module in a supported fashion. In the absence of a compiler checkable restriction, you have to write documentation and hope that it is followed, and use unit tests to demonstrate intended uses. Declaring Types is the most obvious ...

8

A bit of history is in order, I think. The era from the mid-1960s to the mid-1970s is known today as the "software crisis". I can't put it better than Dijkstra in his Turing award lecture from 1972: The major cause of the software crisis is that the machines have become several orders of magnitude more powerful! To put it quite bluntly: as long as ...

8

Procedural/functional programming is in no way weaker than OOP, even without going into Turing arguments (my language has Turing power and can do anything another will do), which do not mean much. Actually, object oriented techniques were first experimented in languages that did not have them built-in. In this sense OO programming is only a specific style ...

8

Google brought up a similar question with an answer that I think is very good. I've quoted it below. There's another distinction lurking here that is explained in the Cook essay I linked. Objects are not the only way to implement abstraction. Not everything is an object. Objects implement something which some people call procedural data ...

8

In [1] (authored by one of the co-creators of Simula), there is a suggestion that Simula 67 may have been the first to use this dot notation. Given that Simula is widely credited for being the first OO language, it may be tricky to find an earlier example specifically in an OO context. EDIT: On DiscreteLizard's suggestion in comments, I took a peek at the ...

7

First, if this is exactly the sentence on the exam and not your translation, it's ambiguous. It could mean that OOD is one possible way to create and use ADT, or that creating and using ADTs requires OOD. Furthermore, ADT can mean two things: abstract data type or algebraic data type. The two concepts are completely different but are often confused. An ...

6

None, really. OOP doesn't really solve a problem, strictly speaking; there's nothing you can do with an object-oriented system that you couldn't do with a non object-oriented system- indeed, there's nothing you can do with either that couldn't be done with a Turing machine. It all turns into machine code eventually, and ASM is certainly not object-oriented. ...

6

I suspect that this is intimately related to shadowing of fields in Java. When writing a derived class, I can, as in your example, write a field x that shadows the definition of x in the base class. This means that in the derived class, the original definition is no longer accessible via name x. The reason Java allows this is so that derived class ...

6

The key to remember is that there's a sort of dualism between functional sum types, and OOP implementations of a superclass or interface: Sum types require the variants for a type to be specified up front, and for every operation, requires that we specify the operation for each variant. Adding a new operation is easy, adding a variant requires refactoring ...

5

A recent paper on this topic that I stumbled upon is Incremental Dynamic Updates with First-class Contexts by Erwann Wernli, Mircea Lungu, and Oscar Nierstrasz. The approach taken in the paper is not based on global updates. Rather, multiple versions of a system run simultaneously in what is called a context. Objects are gradually migrated from one context ...

5

In statically-typed object oriented languages (like Java), you can not create an object of an abstract class. Abstract classes are (usually) not completely defined, so creating such an object wouldn't make any sense. What you can create is a reference to an object instance of an abstract class. A reference is just a pointer to an object, not the object ...

5

Without the last list: merge(<B,D,O>, <C,F,O>, <D,O>) = <B,D,C,F,O> With the last list: merge(<B,D,O>, <C,F,O>, <D,O>, <B,C,D>) = <B> + merge(<D,O>, <C,F,O>, <D,O>, <C,D>) = <B,C> + merge(<D,O>, <F,O>, <D,O>, <D>) = <B,C,D,F,O> ...

4

Do not be too obsessed with it. It is often only buzzwords covering a fuzzy trend (from structured to object oriented) towards better organization of programs, with somewhat different realizations in different languages. It can appear in any programming paradigm, whether imperative or declarative. They are intended to improve readability of programs, good ...

4

In Java, there is no 'static type of an object' - there is the type of the object, and there is the type of the reference. All Java methods are 'virtual' (to use C++ terminology), i.e. they are resolved based on the object's type. And btw. '@Override' has no effect whatsoever on the compiled code - it is just a safeguard that generates a compiler error if ...

4

They're orthogonal. In declarative programming, you describe what would count as an acceptable solution, without necessarily describing how to find it. For instance, a declarative program might have rules like "if you want to install the package gcc, you must have first installed the binutils and cpp packages" and "if you want to install the binutils ...

4

JavaScript looks perfectly like untyped sigma calculus. It supports first-class citizens, described in paper concepts in terms of prototypes, closures, clone (called split), (dynamic) method override, objects dynamic creation, extension, delegation, subsumption, object fragments and polymorphism (which is understatement in terms of this language). ...

4

Depending on the programming language, some or all objects might have reference semantics. What this means is that when you assign the object to a variable or pass it to a method, it's still the same object, not a copy. This means the object maintains identity independent of the values it holds. For example, in C#, classes have reference semantics, while ...

4

Hm, I don't have the points to comment, but are you sure you mean that? Classes already are a sort of sum type: polymorphism means that a variable declared to refer to something of type "A" could instead refer to an object of any of its subclasses B, C, etc. - so this is like a tagged union. And of course, as you say, objects are also product types, in ...

4

It does not matter how you implement multiple inheritance, the inherent issues coming from that still apply. If $C$ is a class, and $D$ a derived class (subclass), and $d:D$ we can write d.foo() to call a method that can be defined in $D$ (possibly ovverriding $C$'s own method) or the method which is inherited from $C$ (and not overridden). In any case, ...

3

Having written embedded C for a few years managing things like devices, serial ports, and communications packets between the serial ports, network ports, and servers; I found myself, a trained electrical engineer with limited procedural programming experience, concocting my own abstractions from the hardware which ended up manifesting in what I later ...

3

"Constructor anomaly" is not a bug or anything; it is simply an anomaly on the classification of constructor functions. ie. constructor functions are different from member functions in the following ways. Anomalous classifications: While most member functions require an instance and work on an instance, a constructor does not require an instance, but still ...

3

I recommend you look at BML. It is like JML, but for Java bytecode. It allows you to specify contracts (preconditions, postconditions, data structure invariants) at the bytecode level. I think the tools Umbra, JACK, and the Mobius program verification environment support BML, and the Mobius project is building tools that work with BML. See, e.g., the ...

3

You would also want to keep in mind that the state of an object is an "abstract" entity, as determined by what is observable by the methods. For instance, an object that implements a hash table has as its state, the collection of values stored in the hash table, not all the internal representation details.

Only top voted, non community-wiki answers of a minimum length are eligible