Live data from Hacker News

Execution in the Kingdom of Nouns (2006)

steve-yegge.blogspot.de

61–70 of 73 posts

Re: Execution in the Kingdom of Nouns (2006)

#61
post #55

Earlier quoted context omitted.

Sure, which you can use the following ways: * C: function pointer * Pascal/Delphi: procedural type * JavaScript: function/expression as r-value (weakly typed) * C#: delegate * Java: er, ah, well, I guess you're screwed, as there is no way to pass that function around to other functions. Maybe in Java version N+1! (or Scala or Groovy) -- that is, a static function is even worse than a "virtual" function, since you can…

I believe the Java equivalent is something like passableF = new NotAClosure() { public void execute(int i) { return f(i); } } But maybe someone knows better than me. I've had thankfully little to do with Java recently. EDIT: Which I guess defeats the purpose of "without an object", but...

Just to note, I am in no way claiming Java is superior. Java is inferior in ways I think are not the ones Yegge claims.

For me, these are the things Java sucks at.

1) There is no easy way to create lists or maps. Look at python; how easy it is to create a dictionary. In Java, you have to "write code" to put elements in a map.

2) Reflection is very weak. It is not type checked at compile time. You have to write a lot of garbage just to run the show.

3) The getters/setters are a hell. Not to write them mind you, but the amount of cruft that creeps in, that you have to filter out to get to the heart of the problem during reading.

4) The constructors: A a = new A() (wtf....)

5) piss-poor Generics.

6) File Operations are pure crap.

7) One class per file? Omg.. For a long time, I thought i sucked at OOPS. The single biggest reason it took me long to get acquainted with OOPS is because of one class per file. Any other class is a new file, a context switch in my mind. In Java, Objects are first class entities; it should be cheap(in terms of things i need to look at) to define, create, and switch between them.

Finally, I think Java sucks because of its verbosity. And a subliminal style that it supports. There are a lot of programmers in Java who think the best way of multiplying two numbers is to add one of them other number of times . Somehow, everything should be drawn out.

Re: Execution in the Kingdom of Nouns (2006)

#62

Yeah, but you can always have static methods, which let you call a function without creating an object.

Sure, which you can use the following ways: * C: function pointer * Pascal/Delphi: procedural type * JavaScript: function/expression as r-value (weakly typed) * C#: delegate * Java: er, ah, well, I guess you're screwed, as there is no way to pass that function around to other functions. Maybe in Java version N+1! (or Scala or Groovy) -- that is, a static function is even worse than a "virtual" function, since you can…

Java has had anonymous inner classes for a very long time. They are a bit verbose, but did the job as a first-class functiona alternative very well back in the day, to the point that I actually miss them in C# that did have first class functions (b/c anonymous inner classes were useful beyond just first class functions!).

The only reason it has take Java so long to add lambdas is that anonymous inner classes did the job well enough for many years; the pressure to add them just wasn't strong enough (a victim of its own success, so to say).

Re: Execution in the Kingdom of Nouns (2006)

#63
post #53

Earlier quoted context omitted.

Is "eat" a noun too now? What's the subject of the previous sentence? If we insisted on only using gerunds + "do", English would be a very strange world indeed. I imagine it would sound much like Java often does: "Eating is done by me of a sandwich.". Sometimes even "An eating is done [...]" :) PS: The author is hardly illiterate. That's plain uncharitable.

What's the subject of the previous sentence? "eat". Words used as words are nouns in that context. Like the word "eat". Like the word "word". When something is eaten, someone or something is doing the eating, eat" doesn't eat itself. I think it's fair to be a bit harsh when the entire essay is based on grade-school level misunderstanding of what nouns and verbs are.

The question was somewhat rhetorical.

The point I was trying to convey was that even though verbs can be used in a noun context, that doesn't really make them nouns.

Similarly functions and objects. There's a certain verbiness to a multiply function that a Cat object doesn't have.

For further consideration: "It rained." What's doing the raining?

Re: Execution in the Kingdom of Nouns (2006)

#64
post #55

Earlier quoted context omitted.

I believe the Java equivalent is something like passableF = new NotAClosure() { public void execute(int i) { return f(i); } } But maybe someone knows better than me. I've had thankfully little to do with Java recently. EDIT: Which I guess defeats the purpose of "without an object", but...

Just to note, I am in no way claiming Java is superior. Java is inferior in ways I think are not the ones Yegge claims. For me, these are the things Java sucks at. 1) There is no easy way to create lists or maps. Look at python; how easy it is to create a dictionary. In Java, you have to "write code" to put elements in a map. 2) Reflection is very weak. It is not type checked at compile time. You have to write a lot…

My "favourite" thing about the One Class Per File thing is that (certainly when I last used it) javac would refuse to compile the class file unless it was in a directory tree identical to its namespace, and you fully specified that on the command-line.

  # Worked
  javac org/eclipse/something/SomeClass.java

  # Failed
  cd org/eclipse/something/ && javac SomeClass.java

Re: Execution in the Kingdom of Nouns (2006)

#65

It's funny that this is so popular, because I think it is probably the single most counterproductive thing written about software ever. Seriously. As far as I can tell, the only point of speaking about the poor oppressed "verbs" is to screw up the thinking of the reader, making the reader feel sorry for them. It seems to have worked in some cases, but is there some other reason for it? But what really annoys me is th…

Its a story, not a technical blog post.

Re: Execution in the Kingdom of Nouns (2006)

#66

Earlier quoted context omitted.

Sure, which you can use the following ways: * C: function pointer * Pascal/Delphi: procedural type * JavaScript: function/expression as r-value (weakly typed) * C#: delegate * Java: er, ah, well, I guess you're screwed, as there is no way to pass that function around to other functions. Maybe in Java version N+1! (or Scala or Groovy) -- that is, a static function is even worse than a "virtual" function, since you can…

* C: function pointer is a hack. The evidence of this is in the code. Most people don't even know it can be done, and it is rarely done in code(in some central piece no body looks at) * Pascal: It's been a decade since I last looked at it, but I don't know if procedural type can be passed around. * Java: Yep, Java doesn't have first class functions. Will give you that. However, in his example, Yegge was talking as if…

Your example is an interesting case of using anon inner classes to be able to wrap and pass back static functions.

Alas, all the alternate functions are defined in one place in advance for the caller/user of "funcMap()", which makes it hard for an app to put in definitions for a library. To get out of that, you have to make an interface than funcMap()'s container implements, and add more code -- Yegge's point! (verbosity)

It's still a useful technique, just verbose.

Re: Execution in the Kingdom of Nouns (2006)

#67

Earlier quoted context omitted.

You can fake objects and subclassing with closures, in addition to making it trivial to implement the "one method interface" (aka "functor"). http://roboprogs.com/devel/2010.06.html (example using a subset of JavaScript, rather than a language likely to be unfamiliar to most) TODO: edit example someday to get rid of "useless use of local variables" (in place of original formal parameters), fix where I call the outer…

> Of course, it's easier to work with both real objects AND real functions/closures/lambdas -- I can use a hammer and a screwdriver :-) But do you hit your screwdriver with the hammer, or do you twist your hammer with the screwdriver? This can be a real problem if one programs in Scala.

Not too often, but I find myself using the screwdriver for a chisel, and the hammer for a plumb bob.

I probably need to buy more tools :-)

Re: Execution in the Kingdom of Nouns (2006)

#68
post #55

Earlier quoted context omitted.

I believe the Java equivalent is something like passableF = new NotAClosure() { public void execute(int i) { return f(i); } } But maybe someone knows better than me. I've had thankfully little to do with Java recently. EDIT: Which I guess defeats the purpose of "without an object", but...

Just to note, I am in no way claiming Java is superior. Java is inferior in ways I think are not the ones Yegge claims. For me, these are the things Java sucks at. 1) There is no easy way to create lists or maps. Look at python; how easy it is to create a dictionary. In Java, you have to "write code" to put elements in a map. 2) Reflection is very weak. It is not type checked at compile time. You have to write a lot…

For all of its warts, Groovy really makes much of this more tolerable in an environment that readily interoperates (call either way in/out) with legacy Java code.

Java file handling with dozens of classes still seems a horrific solution, like you said. I don't miss having to constantly check return codes and "errno", vs getting IOException, but I do miss the simplicity some days of "FILE *" and fopen()/popen(). (I also don't miss maintaining code that FAILS to check error codes while doing I/O)

Thanks for your replies, by the way. Thoughtful without being combative.

Re: Execution in the Kingdom of Nouns (2006)

#69
post #38
post #32

Earlier quoted context omitted.

I am happy with you with all that mathy stuff and I agree that it is cool - but it does not address my point which was that functions are black boxes. Once you have 'f' you can compose it whatever you want - but you cannot change its parts - ala universal design pattern (yet another too long Yegge rant: http://steve-yegge.blogspot.com/2008/10/universal-design-pat... ). Sure composing can somehow work for these case,…

Why would you need to change its parts, it can be parameterized over the parts that change, by passing in other functions as arguments. It's also cheap conceptually and syntactically to create new ones, if an existing one doesn't fit the bill.

I don't really know - I've never extensively programmed in functional way (beside studies) - but the point about overriding is that you do it post-hoc you get a library class and you change it. The original author does not need to imagine all the ways you'd like to modify it - and yet by doing some basic structural design and putting stuff into methods he gives you the opportunity to override. Also I imagine that this level of parametrizing - that is if every function in a package is a parameter to another function in that package then it gets messy, but with subclassing/overriding you can change any method and it changes for all other methods.

Re: Execution in the Kingdom of Nouns (2006)

#70

Earlier quoted context omitted.

* C: function pointer is a hack. The evidence of this is in the code. Most people don't even know it can be done, and it is rarely done in code(in some central piece no body looks at) * Pascal: It's been a decade since I last looked at it, but I don't know if procedural type can be passed around. * Java: Yep, Java doesn't have first class functions. Will give you that. However, in his example, Yegge was talking as if…

Your example is an interesting case of using anon inner classes to be able to wrap and pass back static functions. Alas, all the alternate functions are defined in one place in advance for the caller/user of "funcMap()", which makes it hard for an app to put in definitions for a library. To get out of that, you have to make an interface than funcMap()'s container implements, and add more code -- Yegge's point! (verbo…

1. No, its not an anon inner class. Anon inner class is when you implement a interface, by defining its methods inline.

2. Yes, it is bad that we have to write all that verbose code. Java's typechecker is useless where it could be most useful, by typechecking high level types. You have to write all this code everytime to make it happy.

Post reply on HN