User loginNavigation |
archivesA paper on psychology and programmingA couple of months ago the topic of psychology and computer programming came up in a thread; it was noted there didn't seem to be a lot of work done in the area (iirc). This paper actually has some hard data about novice developers who were given multiple different IQ/psych test then their success in implementing 'knowledge based' systems was measured. Interesting read: http://www.scribd.com/doc/15554396/Knowledge-Based-Systems-A-Study-of-new-Developers Extension Methods versus Structural Typing of Traits for solving the expression problemHere is a neat little thing that is tying my brain up into knots: Given a Java-like language, what would you prefer Extension Methods (ala C#) or Traits + Structural Typing. My working (read as: probably incomplete) definition of a trait is an interface with concrete methods. Unless I am mistaken the expressiveness of the two techniques would overlap significantly: Example 1 (extension methods): class A { int m = 42; int f() { return m; } } extension B of A { int g() { return f() * 2; } } A x = new A(); print(x.g()); Example 2 (traits + structural-typing) class A { int m = 42; int f() { return m; } } trait B { abstract int f(); concrete int g() { return f() * 2; } } B x = new A(); // Notice: A never explicitly "implements" B print(x.g()); I haven't looked at Scala in a while, so can you do this in it yet? I believe it is a direction they were going. For what its worth, the second approach appeals to me a bit more, because it is more discplined, and doesn't clobber the nice encapsulation advantages of classes. Now if I am not already way out in left-field, are these not both examples of solutions to the "expression problem" (http://www.daimi.au.dk/~madst/tool/papers/expression.txt)? Well I know that in example two I am cheating because there is a cast of "A" to "B". So I would call it a solution to the "weak expression problem". You can guess what I mean by that. |
Browse archivesActive forum topics |
Recent comments
22 weeks 3 days ago
22 weeks 3 days ago
22 weeks 3 days ago
44 weeks 4 days ago
48 weeks 6 days ago
50 weeks 3 days ago
50 weeks 3 days ago
1 year 1 week ago
1 year 5 weeks ago
1 year 5 weeks ago