Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
sreque
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
12 ms
·
61.
▲
by
sreque
6y ago
That statement is neat but it looks to have little to do with programming and more to do with programming style. What about Smalltalk, the language, for instance, helps you "eliminate state oriented metaphors" any better than any
62.
▲
by
sreque
6y ago
Method calls and virtual method calls are not the same thing.
63.
▲
by
sreque
6y ago
When I see "no code on disk" I see that as a downside. What happens when this generated code has a bug? How do I set a break point in this code? How do I see the code to know what it is doing? Extending the compiler is great... un
64.
▲
by
sreque
6y ago
I don't think this is true in theory or in practice. Java's Integer.valueOf(String) throws an unchecked exception if it fails, and you should very much be aware of it and catch it in many situations. Also, in many situations, it
65.
▲
by
sreque
6y ago
IIRC, Alan Kay says OO is message passing, encapsulation, and extreme late binding. In java: * message passing is virtual method invocation * encapsulation is through public vs private members * late binding is through the JVM dynamic linki
66.
▲
by
sreque
6y ago
I agree with the part of your post where you show that checked exceptions are bad, but IMO Java has been OO from the start. And, if by procedural code you mean code that has zero abstractions, then, yes checked exceptions aren't a prob
67.
▲
by
sreque
6y ago
It's definitely not ideal, but I use Optional to replace nulls in Java and I think it works fine. Similarly you can return values that could represent an error. Or, you can throw an unchecked exception. Callers should be aware of all e
68.
▲
by
sreque
6y ago
IMO the solution is to either: * Use return values and let people deal with the boilerplate ala Optional in java. We use Optionals to replace null values and IMO the boilerplate is 100% worth it. I've also used return values that can e
69.
▲
by
sreque
6y ago
I can't write a method like this: public <T> higherOrderFunction(Function<T> f) throws whatever f throws { } I can write a method that takes in a function object that throws zero checked exceptions. I can write a method tha
70.
▲
by
sreque
6y ago
It's important to understand that spring gets around the wiring problem by being a system for declaring and using global variables. This turns out to be a fundamental waste of time, as the whole point of making things dependency-inject
71.
▲
by
sreque
6y ago
You can easily and correctly summarize Spring as follows. Spring tries to solve the problem of "applying parameters to function is boilerplatey" by creating a DSL for declaring and using global variables, because, global variables
72.
▲
by
sreque
6y ago
Checked exceptions are far from fine, and this has nothing to do with IDE code generation. Monads are highly cumbersome, unwieldy, and difficult to use, but Haskell programmers put up with them anyways because they get specific value from t
73.
▲
by
sreque
6y ago
OmitStackTraceInFastThrow has caused so many headaches in debugging production issues, and each time now the answer has been to just disable it. The real answer is to stop trying to abuse exceptions as a form of general control flow.
74.
▲
by
sreque
6y ago
Perhaps because the complexity budget of trying to get checked exceptions right is so high that no one even bothers to try. Once you find yourself able to just return values representing an ADT, then why bother? If the point of a checked ex
75.
▲
by
sreque
6y ago
I'm surprised how controversial this is; checked exceptions are a mistake. There is a reason C#, Go Swift, Rust, Scala, etc. don't have them, and it's not because these language authors don't know what they are doing. Ch
76.
▲
by
sreque
6y ago
Return values are a million times better than checked exceptions because return values compose and return values don't collide with the rest of the langugage. Checked exceptions are basically monads but with all the disadvantages of mo
77.
▲
by
sreque
7y ago
Right. I'm not saying inheritance should never be used; just that it can be a distraction for learning what OOP is really about. If I were to teach OOP in Java to new students, I might start out just focusing on interfaces.
78.
▲
by
sreque
7y ago
You can have an encapsulated object that is immutable and is not a bag of static functions anymore than any object is a bag of static functions. Look at Scala's interfaces for immutable collections. * they are encapsulated. You don
79.
▲
by
sreque
7y ago
Classes are a means to an end: objects. Objects give us the three core components of OOP: * encapsulation * message passing * late binding Things like inheritance tend to muddy the waters. If you aren't benefiting from the above 3 thin
80.
▲
by
sreque
7y ago
Unsafe lets you manipulate memory without any JNI overhead other than when allocating or de-allocating memory, and that is usually done in larger chunks and pooled to avoid the overhead at steady state. Netty also takes advantage of Unsafe
81.
▲
by
sreque
7y ago
This article reiterates the belief that jvm start-up time is slow is somewhat a myth. When. I measured it years ago, I found jvm start-up time to be roughly equivalent to node.js. What makes start-up time bad in any interpreted language, in
82.
▲
by
sreque
7y ago
The problem is enterprise Java and the Java community, not the jvm. If people wrote more god-like code in Java, we'd have much leaner Java processes. Instead, we have heavyweight, performance-insensitive frameworks like spring and hibe
83.
▲
by
sreque
7y ago
Language changes are super important when they enable you to program in a new way, or in that way with significantly less boilerplate. For instance, Java 8 enabled new ways of programming via Lambdas and structural typing. You could code in
84.
▲
by
sreque
7y ago
Am I the only one that thinks Blizzard is in the right here and they are being made into a scapegoat due to the political climate? Blizzard says "don't talk about divisive things using our tournaments and communication channels.&q
85.
▲
by
sreque
7y ago
I measured startup of the runtimes a long time ago, and back in the days of node.js 010.x at least, Python 2's startup time was twice as fast as Node.js's, and Java's wasn't much worse than Node.js. I don't know how
86.
▲
by
sreque
7y ago
I find it interesting to see this similar kind of behavior in video game economies like with Path of Exile. There are people who spend all day looking for good deals or opportunities, and essentially buying and reselling, maybe with some mi
87.
▲
by
sreque
7y ago
I don't think what you're saying is true. I already said I think it would have been better if Python and Ruby had explicit variable declarations. But, if this is your biggest issue with a language and it's ecosystem, then IMO
88.
▲
by
sreque
7y ago
Ah my bad. I think I would have understood it more if he included the typo in his example.
89.
▲
by
sreque
7y ago
My bad. I didn't realize you were against all dynamic languages in particular. FWIW I prefer Java and static types as well, but as far as scripting languages go, I think Python is pretty great.
90.
▲
by
sreque
7y ago
I still don't think you quite understand what's going on here. Python wouldn't create a new variable in this case. I It would re-assign the value represented by the variable you already assigned once. I agree that it would ha
More ›