The Nato night team were watching the drones pounding Ukraine. But then one squadron banked starboard - and headed straight for Poland. Lights started flashing...
Netanyahu warns 'anyone who attacks us - we will reach them' as Israel carries out air strikes targeting Houthi military camps in Yemen a day after attacking Hamas in Qatar
Revealed: Keir Starmer edited manual on interpreting human rights laws that prevent Britain from deporting small boat migrants
Charlie Kirk dead at 31: What we know so far about MAGA star's death at Utah campus that sent shockwaves around the world as FBI botches arrest and Trump promises ultimate punishment
Gary Lineker BEATS Ant and Dec for Best Presenter gong at the National Television Awards in shock win - officially ending Geordie duo's 23-year streak as Strictly and This Morning also win big
Tragedy as Charlie Kirk's wife left behind with two young children after conservative activist is fatally shot
'You made your bed, you can lie in it': The haunting words spat out to an unmarried mother as she was left to give birth alone... before her newborn was snatched and put up for adoption in the blink of an eye
'Questing Quokka' enters UI freeze as Ubuntu 25.10 nears release
The Quokka is a small, furry, and perpetually smiling marsupial from Australia. It's very cute – and now it's freezing.…
CodeSOD: The Getter Setter Getter
Today's Java snippet comes from Capybara James.
The first sign something was wrong was this:
private Map<String, String> getExtractedDataMap(PayloadDto payload) { return setExtractedDataToMap(payload); }Java conventions tell us that a get method retrieves a value, and a set method mutates the value. So a getter that calls a setter is… confusing. But neither of these are truly getters nor setters.
setExtractedDataToMap converts the PayloadDto to a Map<String, String>. getExtractedMap just calls that, which is just one extra layer of indirection that nobody needed, but whatever. At its core, this is just two badly named methods where there should be one.
But that distracts from the true WTF in here. Why on Earth are we converting an actual Java object to a Map<String,String>? That is a definite code smell, a sign that someone isn't entirely comfortable with object-oriented programming. You can't even say, "Well, maybe for serialization to JSON or something?" because Java has serializers that just do this transparently. And that's just the purpose of a DTO in the first place- to be a bucket that holds data for easy serialization.
We're left wondering what the point of all of this code is, and we're not alone. James writes:
I found this gem of a code snippet while trying to understand a workflow for data flow documentation purpose. I was not quite sure what the original developer was trying to achieve and at this point I just gave up
[Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.Was the high-heeled shoe invented because of one Queen's sexual jealousy?
Royal daughters who have raided their mother's designer wardrobes - and vice versa
Inside James Middleton's low-key marriage to Alizée Thevenet and how Kate's sister-in-law gained the royal seal of approval after an unexpected meeting
A third of side hustles bring in less than £100 a month
World-beating ovens, engineers and hidden gems: Why European small caps could be a boon for investors
How sustainable are EVs and why is the Government only offering grants to 'truly green' electric cars?
Police warning as drug dealer found with drugs inside vape in Maldon
Just because you can render a Doom-like in SQL doesn't mean you should
The world has moved on from making Doom run on increasingly ridiculous devices. Now it's all about porting it to the most inappropriate of languages. Cue DOOMQL, a version of the shooter written in pure SQL.…
NASA bars Chinese citizens from its facilities, networks, even Zoom calls
NASA has barred Chinese nationals from accessing its premises and assets, even those who hold visas that permit them to reside in the USA.…