News for hackers. Stuff that matters.
Re:Kay on the Meaning of "Object-Oriented Programming" by seles on Tuesday June 07, 2011 @10:42AM (#2629300)
What is wrong with data?
Re:Kay on the Meaning of "Object-Oriented Programming" by cousin_it on Tuesday June 07, 2011 @01:35PM (#2630074)
Nothing! The extreme opposite to Smalltalk in this respect is the APL/J/K family of languages where everything is expressed as mathematical operations on multidimensional arrays of data. For example, a K programmer wouldn't use an array of rectangles, preferring to have separate arrays of widths and heights. It's a very eye-opening programming style in its own right, and a curious programmer would do well to get acquainted with both.

Here's a nice page of "K finger exercises": http://kx.com/technical/contribs/eugene/kidioms.html . To someone who grew up on modern OO languages, it's unbelievable how much K manages to accomplish in one line of code.

Re:Kay on the Meaning of "Object-Oriented Programming" by silentbicycle on Tuesday June 07, 2011 @02:53PM (#2630385)
There is a trial version of q (a newer k variant) at the Kx website, and a couple of us are also working on Kona, an ISC-licensed k-like language, at http://github.com/kevinlawler/kona .

The k way of doing things is indeed eye-opening. There is some documentation for Kona on its github wiki page, and Hakan has an extensive set of k resources at http://www.hakank.org/k/.

Re:Kay on the Meaning of "Object-Oriented Programming" by seles on Tuesday June 07, 2011 @02:57PM (#2630396)
Another opposite extreme is an OOP language which has no methods. And instead each "method" is really just a data variable which is a closure, making it behave nearly identically to a real method. You could avoid needing these "methods" defined for every instance by simulating inheritance using lexical scoping from a parent class.

Although you would need to provide dynamic scope or pass the first argument as self for it to truly behave like a normal method.

The simplicity of this model is appealing to me but I do not know if any existing languages use it?

Re:Kay on the Meaning of "Object-Oriented Programming" by gnaritas on Tuesday June 07, 2011 @11:29AM (#2629510)
It's bad, in the sense that it leads you to write tightly coupled code that depends on it. The whole point of objects are to hide data and instead expose behavior so other code is coupled to the objects behavior rather than its internal implementation on a specific set of chosen data. This leaves you free to fiddle with the internal implementation without breaking the external API, which leads to modular loosely coupled code.
Re:Kay on the Meaning of "Object-Oriented Programming" by shasta on Tuesday June 07, 2011 @02:47PM (#2630363)
But note that this is an argument for encapsulating data and not necessarily bundling it with methods as objects. You can hide data reps with functions.
Re:Kay on the Meaning of "Object-Oriented Programming" by protomyth on Tuesday June 07, 2011 @12:01PM (#2629648)
It also allows the substitution of internal data structures due to profiling / runtime usage of the data.
Re:Kay on the Meaning of "Object-Oriented Programming" by gnaritas on Tuesday June 07, 2011 @12:04PM (#2629663)
Which is the point of modular code, to be able to fiddle with the internals for whatever reason you like without affecting clients.
Re:Kay on the Meaning of "Object-Oriented Programming" by protomyth on Tuesday June 07, 2011 @12:14PM (#2629699)
agreed, I was pointing out (badly) that it could be a runtime / compiler decision and not the programmer.