A text editor that doesn’t assume that the keys on my keyboard are in the same order as yours.
A text editor that doesn’t assume that the keys on my keyboard are in the same order as yours.
Aww. I confused “communities” for “instances” when I read the title. Thanks for pointing it out.
Your data quality is questionable. You list only 2 communities for feddit.org. Lemmy Explorer has 148. I doubt that they’re all ‘suspicious’. And if they are, then that flag is itself suspicious.
Please avoid any and all situations in which you might have the chance of handling any kind of categorized data, for the sake of all of us.
There are no inherent “rules” to language, either, but when you don’t followthemthingsgetmessyandyou’reannoyingforeveryoneelese.
Thank you for linking the blog posts. They are a really good deterrent from Clean Code. I once thought I’d read it, but Fowler’s advice really is stupid.
In case you’re wondering why I replied three times: “Do one thing” :)
Exceptions are just bad. They are a separate, hidden control flow that you constantly need to be wary of. The name itself is a misnomer in my opinion, because they’re rarely exceptional: errors are not just common, but an integral part of software development
They may be a part of software development, but they should not be common during the normal execution of software. I once read the hint, “if your app doesn’t run with all exception handlers removed, you are using exceptions in non-exceptional cases”.
Throwing an exception is a way to tell your calling function that you encountered a program state in which you do not know how to proceed safely. If your functions regularly throw errors at you, you didn’t follow their contract and (for instance) didn’t sanitize the data appropriately.
Errors as values are much clearer, because they explicitly show that a function may return an error and that it should be handled.
I disagree here. You can always ignore an error return value and pretend that the “actual” value you got is correct. Ignoring an exception, on the other hand, requires the effort to first catch it and then write an empty error handler. Also (taking go as an inspiration), I (personally) find this very hard to read:
res, error = try_something()
if error {
handle_the_error(error)
return_own_error()
}
res2, error2 = try_something_else(res)
if error2 {
handle_other_error(error2)
return_own_error()
}
res3, error3 = try_yet_something_else(res2)
if error3 {
handle_the_third_error(error3)
return_own_error()
}
return res3
This code mingles two separate things: The “normal” flow of the program, which is supposed to facilitate a business case, and error handling.
In this example, on the other hand, you can easily figure out the flow of data and how it relates to the function’s purpose and ignore possible errors. Or you can concentrate on the error handling, if you so choose. But you don’t have to do both simultaneously:
try {
res = try_something()
res2 = try_something_else(res)
res3 = try_yet_something_else(res2)
return res3
} catch (e) {
// check which error it is and handle it appropriately
throw_own_exception()
}
Functions should be small and do one thing […] you end up with a slew of tiny functions scattered around your codebase (or a single file), and you are forced to piece together the behaviour they exhibit when called together
I believe you have a wrong idea of what “one thing” is. This comes together with “functions should not mix levels of abstraction” (cited from the first blog entry you referenced). In a very low-level library, “one thing” may be sending an IP packet over a network interface. Higher up, “one thing” may be establishing a database connection. Even higher up, “one thing” may be querying a list of users from the database, and higher up yet again is responding to the GET /users
http request. All of these functions do ‘one thing’, but they rely on calls to a few methods that are further down on the abstraction scheme.
By allowing each function to do ‘one thing’, you decompose the huge problem that responding to an HTTP request actually is into more manageable chunks. When you figure out what a function does, it’s way easier to see that the function connectToDb
will not be responsible for why all users are suddenly called "Bob"
. You’ll look into the http handler first, and if that’s not responsible, into getUsersFromDb
, and then check what sendQuery
does. If all methods truly do one thing, you’ll be certain that checkAuthorization
will not be related to the problem.
Tell me if I just didn’t get the point you were trying to make.
Edit: I just read
Martin says that functions should not be large enough to hold nested control structures (conditionals and loops); equivalently, they should not be indented to more than two levels. He says blocks should be one line long, consisting probably of a single function call. […] Most bizarrely, Martin asserts that an ideal function is two to four lines of code long.
If that’s the standard of “doing one thing”, then I agree with you. This is stupid.
At the end of my 20s I can feel that I’m becoming stupider. Reading texts or just thinking about a problem take more effort than they used to.
From your description this sounds more like a job in IBM’s R&D department than a game
They also agreed to fight climate change. We know how well that turned out.
You’re talking as if watching content on YouTube wasn’t a hobby like going to the cinema or theater.
In a lot of other countries supreme court judges are selected by a non-political committee
My worldwide knowledge of this is limited. In Germany, each of the two ‘houses’ of parliament (Bundestag and Bundesrat) elect one half of the ‘Supreme Court’’s (Bundesverfassungsgericht) members (judges and other staff).
That will only be an option if content creators don’t use it either. And they will look where their audience goes, which will mostly be nowhere.
Ok, then we agree on all points except term limits for judges. Forced retirement is fine by me, but yanking them out of office before they retire has the drawback I mentioned before.
Political Supreme Court appointees that are appointed for life (!),
Judges are appointed for life, so they can be impartial and don’t need to worry about who won’t hire them after their term ends if they made unfavorable decisions.
the absurdly long election cycles…
4 years is absurdly long to you? Getting things done in politics takes time. How long should the cycle be in your opinion?
Indeed, I got the terminology wrong. „Kebap“ is the meat, „döner” means it turns.
Döner Kebab isn’t even a Turkish specialty. In Turkey, Döner (referring to the meat that turns) is served on a plate with salad and bread. It’s not fast food like the German Döner Kebab, and it’s not meant to be taken to go.
Döner Kebab was invented in Germany by a Turkish immigrant whose traditional Döner didn’t fare well, because Germans were always in a hurry.
Or so the story goes that I heard in a documentary on German TV about 15 years ago.
There’s nothing to say about this
Damn.
You must have exceptionally competent first-level support.