Wherefore `from` in LINQ?
-
@Maciejasjmj Why is the code shit if it works?
-
@lucas1 said in Wherefore `from` in LINQ?:
@Maciejasjmj Why is the code shit if it works?
Because "it works" is not the only measure of code quality. A code that works, but is unperformant, unmaintanable or untestable is still shit.
Sure, it might be shit that you can push to the client and get away with it for a while. But it's still shit.
-
@Maciejasjmj if it works well enough for the client that is paying you it is.
-
@Maciejasjmj said in Wherefore `from` in LINQ?:
A code that works, but is unperformant, unmaintanable or untestable is still shit.
It's sometimes like fixing a leak in the fuel line on an engine with chewing gum. It might get you home, but you sure don't want to use it for longer than necessary.
-
@dkf said in Wherefore `from` in LINQ?:
@Maciejasjmj said in Wherefore `from` in LINQ?:
A code that works, but is unperformant, unmaintanable or untestable is still shit.
It's sometimes like fixing a leak in the fuel line on an engine with chewing gum. It might get you home, but you sure don't want to use it for longer than necessary.
Except the chewing gum never gets removed until it's fused permanently to the engine.
And since the fix worked the first time, it's now a rule that all leaks are to be fixed with chewing gum.
And the passengers are now forced to breathe in the fumes of burning rubber and Doublemint every time they start the car, by design.
Millions are piped into R&D to determine whether peppermint or spearmint works better on engines.
Some day, someone tries to fix the engine with Big Red and the cinnamon flavor burns a hole in it. The sales department has a wonderful time explaining how the hole is necessary for airflow.
In the end, someone decides to replace the engine with a large jawbreaker. This works, because the car is actually powered by an auto-fed hamster in a wheel someone put in to bypass the broken engine, and no one noticed.
-
@Maciejasjmj And then Volkswagen gets done for cheating by using gerbils
-
@RaceProUK said in Wherefore `from` in LINQ?:
cheating by using gerbils
Should've stuck to hamsters. They're government-approved and Oracle-certified.
-
@lucas1 said in Wherefore `from` in LINQ?:
@Maciejasjmj Why is the code shit if it works?
This whole site is literally about shit code. Most of the code posted here "works," but the reason we talk about it is because it's shit. That you could hang around here as long as you have but not understand this, sadly, doesn't surprise me as much as it should.
-
@dkf nope, because it works
-
@lucas1 “It works” is the minimum, and if you decide to do something like sorting an array in production code by doing random permutations until you come across one that is sorted — an algorithm that technically produces the right answer, but might take a very long time to do so (depending on how the probability gods decide to screw with you today) — I will personally rip your gonads out through your throat. It might “work” but the quality of service is utterly terrible.
-
@dkf I am talking more generally
-
@dkf said in Wherefore `from` in LINQ?:
I will personally rip your gonads out through your throat.
Damn.
Seeing @dkf say that is like hearing Mr Rogers curse someone out.
-
@dkf So you don't care about the customer.
-
@dkf said in Wherefore `from` in LINQ?:
you decide to do something like sorting an array in production code by doing random permutations until you come across one that is sorted
Could be worse. Could be stacksort. (title text of https://xkcd.com/1185/)
-
@lucas1 said in Wherefore `from` in LINQ?:
@dkf So you don't care about the customer.
You care about the customer until you get paid. We care about the customer for longer than that. We also care about our fellow developers.
-
@lolwhat Why can't you do both?
-
@lolwhat Those other developers can include our future selves. There's nothing like having to develop and support a piece of code for a few years to teach you to use good habits; bad practice bites you in the ass. Also, I've seen projects ruined by a culture of dashing from one instance of doing just enough to satisfy the customer to another, as those sorts of customers are never happy about taking time to retrench, cut the technical debt, and think out how to plan for the future…
The particularly bad thing is that the “project management by impending crisis” approach almost works for a while. The big problems with it are in the fact that it applies what's really a strictly local optimisation function (so the system can easily get stuck in a poor situation in global optimisation space) and stresses the hell out of most developers.
-
@Maciejasjmj said in Wherefore `from` in LINQ?:
Because "it works" is not the only measure of code quality
Indeed. The traditional measures of quality include:
- Functionality: "it works"
- Maintainability: someone can fucking read it and make changes in the future
- Security
- Performance: "it works fast"
- Reliability: "it keeps working"
Shit code is functional but isn't maintainable and often not secure or performant.