- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
*spotted a duplicate sentence (that will probably be gone by the time it's published)*
Admin
Wow, INB4 :hanzo:, just about to hit reply when this came in!
Wait, what's a 💩.la supposed to be?
Admin
Whatever it is, the domain doesn't resolve
Admin
Agreed. Should have stuck to plain ol' unicode characters. ¯(°_o)/¯
Admin
1.5
Admin
Hmm,
Admin
I don't know about you, but I want my programmers to be proactive and make sensible improvements where they are able; it's rare you get any significant period of time to clean up a codebase, so why not do it in parallel with everything else?
Admin
How is that suppose to work if you close and open another connection in step 3 and 4? Would you not get a different port?
Admin
Admin
Usually for each sprint in my code base I add a few items to clean up the technical debt that might have crept in along the way. In that way the Technical debt remains manageable and the code base doesn't get so bad I want to run away from it or rewrite it from scratch.
Admin
I was with Bradley up until the last part where he created a new exception type for each operation - WTF?
Admin
FTFY. Refactoring should happen all the time. Especially after a rushed delivery, otherwise the technical debt accumulates and people like me who take pride in their work (admittedly not straightforward with javascript) and have a choice end up leaving.
Tangentially, I have been told this:
Obviously they told me in more words to try and obfuscate the flagrant output of :poop: from their talk-holes.
Admin
You dropped your right arm.
Admin
I think a dischorse ate it, actually.
Admin
And yes, screwing around at will with functions you don't know and for which there are no unit tests just to make them look nicer is just asking for time bombs. BTDT.
Admin
Admin
¯\_(ツ)_/¯
Admin
💩.la looks like a mojibake... python to the rescue:
Admin
Ah, at least http://💩.la resolves :smile:
...and Discourse styles it as a link, but makes it unclickable. Yay.
Admin
So, he failed to follow the requirements, he changed the code willy-nilly without knowing how it's externally used, and all that because I want to write good code, dammit!?
Look mate, we all do, we all do, but the reason why it's so hard is that you really can't just fix stuff that's used elsewhere as you go along.
Admin
That and the lack of being able to stab people in the face across the Internet.
Admin
Admin
That's basically been every single development job I've ever had. Never time to go back and refactor code to allow for testing so it can be easily changed, just bang out new features and push everything else to the backburner. I was actually let go from a job (you might recall it being featured in the Shadow Over Shippoint Halloween story) because I kept reminding the CTO (who always told me that he wanted to have a good codebase that allowed for easy changes) about how we really needed to invest time in code cleanup and getting tests running instead of doing silly things like redoing the HTML for a page because it looked better on the iPad, despite none of our customers using iPads.
Admin
Bill doesn't seem to be blaming Bradley for stuff though - what he's actually doing is using his organizational power to protect his own code from modication, because like all not-good programmers he believes his own code is perfect whereas everyone else's code sucks. Good programmers know better - their own code sucks too!
Admin
Actually IIUC if those specific error classes inherit from Error, then all the existing code that catches generic Errors thrown would still work, as per inheritance.
On the other hand thing how much fragile code one would have to write without this change.
Admin
So.... he did that just so he could do all the things in a single try and write 4 catch blocks for each type of exception, instead of writing 5 try...catch blocks so every thing could be in a different one?
I'm not sure that's significantly easier.
edit: what does it return if closeConnection throws an exception? Does the application just crash and burn?
Admin
It may not be that much easier, but it's definitely more maintainable; the actual implementation is in one block instead of being split up by all those
catch
s.Admin
"Drive by Coding" is a major problem (developers making changes that are not specifically required to meet the spec)
"Rotten Code" is a major problem that needs to be addressed, or the application WILL collapse over time.
Apparent conflict.
BUT, if the developer simply logs (they are using a work tracking system that is integrated with their defect management system, right :wink: ) each code issue so that it can be scheduled for review and remediation, things tend to get a lot better (though it takes time).
Admin
Well, if you really wanted to do it in one block, you could... just use a variable to hold the return value and set it before each operation that might fail. In the catch you just return whatever value that held, because it tells you how far the code got.
Admin
Yes, old style exception handling. This is exactly what I think was expected.
Admin
So that would make an interesting coding challenge. Some initial thoughts:
Get them to remove the back cover of their CRT and sit there while you send them the codez to make it implode, sending sharp slivers of glass in every direction.
Mechanical Turk. 'Nuff said.
Admin
FTFY
Admin
That's assuming that it ever gets addressed. In my experience most of the time it doesn't matter if you track the issues or not, it will never ever be scheduled for "review and remediation" because whoever decides that sees no value in fixing what "already works", no matter how shitty/busted it really is.
Admin
About a third of the stuff this site thrives on is due to exactly this.
Btw, anyone here who doesn't experience that?
Admin
True, but wherever it's used, they're catching Exception anyways so it doesn't really matter. They'll still catch it (assuming he's extending Exception) and it will work fine.
EDIT: The only change it might make is to give slightly more useful stack traces. Of course with a company like this, they might be doing the
anti-pattern
Admin
Practically every single article on this site ought to end with the protagonist asking: "Why the fuck did you hire me, if you didn't actually want someone who knows what they're doing?"
Admin
Then it gets logged together with its runtime type, and whoops, you no longer have a
java.lang.Exception
(or whatever Java does there) written into the log, so the job that parses the log file with a regex and sends an email to the developers misses the error, so the devs never learn that their service is crashing until a billion-dollar customer breaks a contract.I mean, likely nothing would happen and everything would work. But the "no changes to the API until you're 100% sure nothing breaks" is there for a reason.
Admin
I hear modern computers have a builtin math professor. Maybe we can entice them to do the stabbing?
Admin
That's true. External connections could be an issue (But if they are doing something like that, that's so stupid... it... I don't even...)
Throwing Exception is probably the stupidest anti-pattern possible though......
Admin
Well, yeah, nobody really argues it's not stupid. But you'll find this kind of stupid shit in every codebase - sometimes it will be the small things like throwing an Exception, sometimes bigger like consistently doing your SQL queries in button click handlers. And I know firsthand how tempting it is to just rewrite this shit altogether, but usually that's not what your time is supposed to be spent on, it can break things, and it leads very quickly to the CADT development model.
Admin
Actually I don't, but I guess I'm in that lucky situation that I decide what needs to be fixed / added and when. (Ok the downside is that I'm also the one which gets the blame if something doesn't work or a change breaks something, but you can't have your cake and eat it too...).
Yazeran.
Admin
But if they are anyway not using exceptions and negatives return values for error handling instead ...
Admin
WHAT!? Surely no customer would try parsing the undocumented debug messages out of the syslog! And they certainly wouldn't then complain when those same undocumented and unguaranteed messages change from release to release...!
Nope, can't do it. I can't even type that with a straight face.
Admin
Isn't JDK 1.5 Java 5?
Admin
I'm always confused by that too.
Admin
I'm not familiar with Java. Would anyone actually notice if you create new exception classes that derive from Exception? At least in C++, if I throw MyException, derived from std::exception, anyone can catch it as a std::exception. If they were already catching as std::exception in the first place, the change wouldn't affect them.
Admin
Remember: the objection was from a guy who freaked out about removing unused
import
s.Admin
Catch, yes. Any other reflection (or RTTI, in C++-lingo) tricks, and you're knee deep in the mud.
And there's still the whole time management thing. Even if the change is functionally a no-op, it still requires resources to make it, process it and run a regression suite (automated if you're lucky) against it. Resources you might or might not have.
Yep, cleaning up the code feels nice, but ultimately it's all about features and bugs, and sometimes taking the technical debt now is what you have to do.
Admin
In Java, everything that you can throw and catch is derived ultimately from
Exception
(stuff you throw but don't catch is derived ultimately fromError
). So if you haveclass Supercalifragilisticexpialidoception extends Exception
,catch (Exception ex)
will catch it.Plus the stuff :fa_arrow_up: above.
Admin
Yes. There's never been a Java 2.5. It went 1.0, 1.1, 1.2, 1.3, 1.4, 5, 6, 7, 8