Live data from Hacker News

Software development topics I've changed my mind on

chriskiehl.com

251–260 of 788 posts

Re: Software development topics I've changed my mind on

#251
post #2

> Java is a great language because it's boring [...] Types are assertions we make about the world This is less of a mind-was-changed case and more just controversial, but... Checked Exceptions were a fundamentally good idea. They just needed some syntactic sugar to help redirect certain developers into less self-destructive ways of procrastinating on proper error handling. In brief for non-Java folks: Checked Excepti…

remind me why they don’t work? because “throws Exception” propagates virally to every method in the codebase?

Because eventually someone will want to add another exception to a new leaf class and the proper place to handle it is 20 functions down the call tree and every single one of those 20 functions needs to now add that new exception to their signature even though only the handler function cares and you adjusted it.

I haven't done java in decades, but I imagine this would get really nasty if you are passing a callback to a third party library and now your callback throws the new exception.

Checked exceptions seem like a great idea, but what java did is wrong. I'm not sure if other implementations are better.

Re: Software development topics I've changed my mind on

#252
> Very few abstractions exist in general application development. Just write the code you need.

I don't try to foresee abstractions (premature optimization), but I often encounter them when adding to a codebase. A recent example would be a tool that uses property info from a public database. The first version was hard coded to the database from one jurisdiction. When I added support for a second jurisdictions, abstractions helped avoid code duplication.

Re: Software development topics I've changed my mind on

#253

It felt good to read someone who thinks like me, honestly. Also the observation of "The trouble with functional programming is functional programmers" is absolutely correct . This needs to be said more. Way more. P.S.: You can ask why, and I can answer honestly, without hostility.

> The trouble with functional programming is functional programmers

> This needs to be said more. Way more.

In other words, why stop with an ad-hominem when you can do an ad-nauseam too.

Re: Software development topics I've changed my mind on

#254

Earlier quoted context omitted.

> you find out you need some caching here, then there Forgive my ignorance, but how do ORMs help with adding caching? Or are you implying they obviate or reduce the need for caching?

They do caching themselves so that some of your queries via ORM won’t hit the actual db.

So, given the main issue with ORM is the object/relational part... (https://web.archive.org/web/20160301022121/http://www.revisi...)

Why is caching not a feature in DB connection pools? I mean, most databases have it on their side, why not have it as an option for the same query sets prior to hitting the db, with configurable invalidations? Or is it, and I've just never thought to look for it.

Re: Software development topics I've changed my mind on

#255
post #75
post #2

> Java is a great language because it's boring [...] Types are assertions we make about the world This is less of a mind-was-changed case and more just controversial, but... Checked Exceptions were a fundamentally good idea. They just needed some syntactic sugar to help redirect certain developers into less self-destructive ways of procrastinating on proper error handling. In brief for non-Java folks: Checked Excepti…

> adding it to your own function signature This is precisely why they are so bad: checked exceptions must not be allowed to be used outside the package (or jar, or whatever, just limit it) otherwise they cause non-local build failures in all dependencies. They're fine if you are developing the artifact that's going to be deployed.

I think that’s more of a problem of changing the function signature. Not specific to checked exceptions.

Re: Software development topics I've changed my mind on

#256

> Most programming should be done long before a single line of code is written Nah. I (16+ years developer) prefer to iteratively go between coding and designing. It happens way too often that when you're coding, you stumble across something that makes you go "oh f me, that would NEVER work", which forces you to approach a problem entirely differently. Quite often you also have eureka moments with better solutions th…

What I think is a better way to say this is that you need a `design` phase before actually writing the first `real` implementation code.

Something I do a lot, and even more with the LLMS, is that I make `scratch` projects where I sketch code over and over (and maybe make mockups in Keynote or similar, make some notes, etc), then write from scratch again in the real codebase.

Re: Software development topics I've changed my mind on

#257

Earlier quoted context omitted.

If the person at the top can come down for a coffee with people who endured some bad management, and ask honest, non-loaded three questions, it can be measured qualitatively but with very high accuracy. The three questions are: - What should we start doing? - What should we continue doing? - What should we stop doing? This is an immensely powerful tool. Thanks to the awesome person who introduced me this. Addenda: "T…

What insight does an IC have on what the person at the top even does? I can basically only comment on my interactions with direct management and I otherwise don't know how they spend their day.

That's not important - you're not discussing how to do their job, but what your own view is of your part of the work and those around you. The leader can then synthesize all these views and see if there are any surprises.

(another case similar to "you should listen to a customer when they say there's something wrong with the design of your product, but you should absolutely not pay attention to what they think the solution should be")

Re: Software development topics I've changed my mind on

#258

> If I think something is easy, that's a sure sign I don't understand it. A lot of people (definitely here) need to understand this.

This was the one that resonated the most with me. As soon as I start to think "Why don't they just . . . ." I know I'm in for an epiphany.

Re: Software development topics I've changed my mind on

#259

No, objects aren't generally 'good', unless you think keeping multiple state machines in sync is 'good'. OO is not evil, but it also shouldn't be your default solution to everything. Also, who is this person? I immediately distrust someone who calls themselves 'a pretty cool guy'. That's for the rest of us to decide.

The way I like to use OO (usually not real OO, but rather class-based languages) is to minimize its mutable state. Often mutability is merely a lack of using builder patterns. Some state can be useful as long as it's easy and makes sense to globally reset or control. It's like writing a process as a construction of monads before any data is passed into it. Similarly a tree of processing objects can be assembled befor…

Exactly. Automatically adding getters and (especially) setters to a class is something I see far too often.

Re: Software development topics I've changed my mind on

#260
post #244

Earlier quoted context omitted.

what is "it doesn't work" ? The exception is part of the type, so it doesn't typecheck unless all callbacks are of type "... throws Exception"? What's the problem with that? It's not generic enough, i.e. the problem is Java generics are too weak to write something like "throws "? (Forgive me, it's been 13 years since I wrote java and only briefly, the questions are earnest) edit, so like `@throws[T <: Exception] def…

You can't be polymorphic between not throwing and throwing, or between throwing different numbers of exceptions. You have to write something like: List map(Function mapper) { ... } List map(FunctionThrows1 mapper) throws E1 { ... } List map(FunctionThrows2 mapper) throws E1, E2 { ... } and so on until you get bored.

Ah because there is no way to express E1 | E2 as a type parameter?
Post reply on HN