To Surface or not to Surface.



  • Ok, so this one's part wtf, part request for advice.

    I'll start with the wtf: here's a CodeSOD I perpetrated recently because I couldn't figure out a better way to get this out of our home-grown orm

       
     1247 +	private GalleryImage getLatestGalleryImage(String imageName) throws StaleFetchException {  
     1248 +		if (StringUtils.isEmpty(imageName)) {  
     1249 +			return null;  
     1250 +		}  
     1251 +		QueryResult query = GalleryImage.createQuery(getSurface(), GalleryImage.FIELD_IMAGE_NAME + " = '" + imageName + "'");  
     1252 +		QueryEnum queryResult = query.elements();  
     1253 +		if (!queryResult.hasMoreElements()) {  
     1254 +			return null;  
     1255 +		}  
     1256 +		GalleryImage latestVersion = null;  
     1257 +		for (Persist element = queryResult.nextElement(); queryResult.hasMoreElements(); element = queryResult.nextElement()) {  
     1258 +			if (element instanceof GalleryImage) {  
     1259 +				GalleryImage image = (GalleryImage) element;  
     1260 +				if (latestVersion == null || latestVersion.getImageVersion() < image.getImageVersion()) {  
     1261 +					latestVersion = image;  
     1262 +				}  
     1263 +			}  
     1264 +		}  
     1265 +		return latestVersion;  
     1266 +	} 
    
    

    we call it (the orm) “the surface” and it's a big fucking deal — our cto and a senior developer here made it, and it's pretty much the heart of our core product.

    It was developed using IBM Rational Rose, and it has some idiosyncrasies. For instance, it can do inheritance, which means that several completely different types of objects will get stored in the same table because they all inherit from profilable or publishable or whatever. They have no fields in common, so the majority of each row is always null e.g. if the discriminator is foo then foo_name will have a value, otherwise bar_name or baz_name will. And don't get me started on how it does caching or concurrency.

    But my main beef with the surface is that it is responsible for like 80% of our data integrity stuff (another 5% is covered by constraints in the db and he rest... well). So for example, if you set the value of a user-scope custom datafield with code=LOCATION for a user (which is what you see when you look up the user's details), the surface will go ahead and set the value of the user_location column (which affects what they will be able to see when they log in). But not when you unset the field, so if you accidentally edit the location of an area manager and then try to undo it you a) are going to be confused because their profile says they're not pinned to a location, but when they log in they clearly are b) will need to get a dev to clear the field c) but not a senior dev, their time is way too precious; rather get some dumbass kid fresh out of college (me) to do it.

    Anyway now the advice part: I've got some basically greenfield work to do, integrating our core product's data with the “next big thing” being developed by another division. My question is: am I trwtf for wanting to do my data access in straight SQL? I mean, on the one hand, we've got something that pretty much works, and could be covering some pretty arcane behavior, that I'm thinking of discarding altogether — on the other hand, I feel like I'm a lot more familiar with our database than our code base, and when I think of my career, I'd much rather be gaining experience in java and sql than in the finer details of the acmecorp (-corp is a misnomer, there's way less than 100 people working here) workflow engine.


  • Discourse touched me in a no-no place

    @Buddy said:

    It was developed using IBM Rational Rose

    Oh. :tom_selleck:

    @Buddy said:

    My question is: am I trwtf for wanting to do my data access in straight SQL?

    No. SQL is actually rather good at data querying, and for anything other than the very simplest of lookups, it's better to hit that SQL to find out what's actually stored.



  • @dkf said:

    NoSQL is actually rather good at data querying

    Fixed that for you.

    Also, I'm afraid I'm going to have to shoot you now. It's for the betterment of mankind, you see.


  • Discourse touched me in a no-no place

    @Lorne_Kates said:

    Also, I'm afraid I'm going to have to shoot you now.

    That's fine. Just come up with the universally understood OWL/RDF statement for how exactly to do that and we can get right on with it.


  • Discourse touched me in a no-no place

    @Lorne_Kates said:

    Also, I'm afraid I'm going to have to shoot you now.

    How? Don't Canadians not have guns? :trollface: Also, aren't universities gun-free zones? :trolleybus: :tropical_drink:



  • @FrostCat said:

    @Lorne_Kates said:
    Also, I'm afraid I'm going to have to shoot you now.

    How? Don't Canadians not have guns? :trollface: Also, aren't universities gun-free zones? :trolleybus: :tropical_drink:

    We're given one when we cross the border into Guntopia, much like you're given a loaner tie when you go to a fancy restaurant without one. It's just a shitty Derringer, but it'll get the job done.

    And of course universities are gun-free zones. But according to the theory, that encourages more gun violence. So I'll be safe. As long as someone else doesn't plan a school shooting that day. (I'll check Tumblr before I leave)



  • @FrostCat said:

    How? Don't Canadians not have guns? :trollface: Also, aren't universities gun-free zones? :trolleybus: :tropical_drink:

    That reminds me...

    My wife found this on someone's Facebook page, which I found rather on point:

    GUNS:
    We defend our President...with guns
    We defend our Congressmen...with guns
    We defend our Governors...with guns
    We defend our celebrities...with guns
    We defend our sporting events...with guns
    We defend our jewelry stores...with guns
    We defend our banks...with guns
    We defend our office buildings...with guns
    We defend our factories...with guns
    We defend our courts...with guns


    We defend our children...with a sign that reads:

    "THIS IS A GUN FREE ZONE."

    ...and then call someone with a gun if there's an emergency.


    Filed under: with apologies to the OP for continuing off topic.



  • And here I was, wondering if the guy who started the thread wanted to buy a Surface 4. Boy, was I wrong.

    The opening post sounds like a clusterfuck of WTF. However, the code sample doesn't look all too bad (believe me, I've seen worse) and the issues reported sound like they are fixable. So... maybe it's a better idea to put the pros and cons of using direct SQL vs using the Surface side by side and to have a good discussion with the project lead(s).



  • @redwizard said:

    We defend our President...with guns
    We defend our Congressmen...with guns
    We defend our Governors...with guns

    In the hands of highly trained security professionals.

    @redwizard said:

    We defend our celebrities...with guns

    Because those chucklefucks pay money for the privileged

    @redwizard said:

    We defend our sporting events...with guns

    WTF? You guys have armed guards at sporting events? Fucking gun nuts. Maybe you wouldn't need to if you didn't have drunk party-bros armed with guns.

    @redwizard said:

    We defend our jewelry stores...with guns
    We defend our banks...with guns

    In the hands of barely trained professionals who are taught to drop the gun at the first sign of a robbery. Money isn't worth getting shot over.

    @redwizard said:

    We defend our office buildings...with guns

    Bullshit.

    @redwizard said:

    We defend our factories...with guns

    Double bullshit.

    @redwizard said:

    We defend our courts...with guns

    Which you wouldn't need if you didn't have criminal chucklefucks running around with guns. Or vigilante chucklefucks running around with guns. Or rando psychos running around with guns.

    @redwizard said:

    We defend our children...with a sign that reads:

    #THIS IA A MISUNERSTANDING OF WHAT THAT SIGN MEANS
    (paraphrased)

    It's a "gun free" zone because they don't want STUDENTS bringing in guns and shooting each other. Because they do. Because putting guns in the hands of untrained, hormone-crazed, emotionally unstable chucklefucks is a bad idea, because they're taught guns are their right and instant gratification is the only gratification, and there's no real consequences for one's actions. And because if that sign wasn't there, then it'd be implicit permission to bring a gun into school. Because you have fucked up concealed carry laws that allow that, on top of the "guns r my RIGHT" mentality. In fact, most states with concealed carry laws REQUIRE signs like that, otherwise the default is "guns allowed".

    So who you gonna put the guns in the hands of? The students? See earlier comments about mentally unstable hormone-crazed testosterone chucklefucks. I'm sure the populace will be safe with all those impulsive-action factories packing heat.

    The teachers? Do they have to bring their own, or will they be provided by the school board? Who is going to train them to use the guns? And I don't just mean how to safely handle one-- but how to handle one in a combat situation, with a 1000:1 ratio of innocents to targets. Especially when the innocents are running around a dark, crowded area in a blind panic? And where in the teacher's contract will it be written that they're expected to be a fucking SOLDIER at the drop of a hat? Will they receive hazard pay? Combat pay? Medical coverage for PTSD for gunning down a student of theirs? Wounded vets pay for when they catch a bullet in the spine for trying to be a hero? For fuck's sake, you barely pay your teachers enough to stay above the poverty line, and shit all over them and their entire profession, and threaten to sue them for emotionally damaging little Billy and Susy Snowflake's fragile ego.

    Maybe you'll arm the administrators instead? The cowardly sociopaths who are TRAINED to be more concerned about their own ladder climbing and CYA than anything else?

    Or maybe you'll hire guards? Whose pay will be cut to afford those? Are you hiring bodyguards? Off-duty police officers? Or the same chucklefucks from banks and jewelery stores who, again, are trained to surrender and run rather than start a confrontation? What sort of legal insurance will these assholes have to have to protect them the first time a parent sues because they didn't adequately protect their kid? Forget even letting a kid die. What if one of them is "traumatized" because the guard didn't stop the school shooting fast enough?

    Or hey, how about we just arm EVERYONE!?! That way, someone will see someone with a gun. A student will draw and shoot them dead-- which will alert the nearest staff member with a gun. She'll rush into the hall, see student 2 with a smoking gun, and student 1 in a pool of blood, clutching their trombone (which looked like a rifle, I swear)-- and open fire, bravely murdering student 2. Which will cause a panic-- guns come out, guards rush in, bullets fly-- and eventually we'll mop up the dead and air out the stench of gunsmoke from the walls.

    Or-- and here's a radical idea-- you could use all that money to find a cure instead of a band-aid.



  • Just one question:

    What part of:

    @redwizard said:

    We defend our children...with a sign that reads:

    "THIS IS A GUN FREE ZONE."

    ...and then call someone with a gun if there's an emergency.

    ..did you misread as:

    @Lorne_Kates said:

    they don't want STUDENTS bringing in guns and shooting each other.

    Note it says "Defend our children with", not "give guns to children/students."

    We already have one person in this forum that misreads things badly, please don't acquire that habit. Thank you.



  • The problem, and the reason I'm on here asking people who can't possibly know enough about the details of this, is that it seems like the answer to that would be mostly or entirely political. The surface is boss+1's baby, and he clearly wants us to use it.

    For example: the surface wasn't designed to be able to connect to multiple clients' databases within a single app; his suggestion is that we should step through it with a debugger and see if it looks like it'll be safe. If that fails, well just have to spin up a whole new server for each of over 100 clients.

    If he ever seems to be losing an argument he says “we'll continue this later”, then waits until my direct boss is out of the office and comes down to tell us how things are going to be.

    The problem is, I'm pretty confident I could get away with doing things in straight SQL, like I want to, I'm just not sure how to get good advice on whether I should.


  • I survived the hour long Uno hand

    Bravo @Lorne_Kates and @FrostCat , that was the fastest "innocent OP to gun control debate" troll I've ever seen.



  • @redwizard said:

    GUNS:We defend our President...with gunsWe defend our Congressmen...with gunsWe defend our Governors...with guns

    Ok, yes, the secret service generally carries guns. Ok.

    @redwizard said:

    We defend our celebrities...with guns

    We... we do? When did that start?

    @redwizard said:

    We defend our sporting events...with guns

    Wha? That's a plain lie.

    @redwizard said:

    We defend our jewelry stores...with guns
    We defend our banks...with guns

    Sometimes. Sometimes these guys carry tasers. Some jewelry store and banks have no guards at all.

    @redwizard said:

    We defend our office buildings...with guns
    We defend our factories...with guns

    No. No we don't. I can't even imagine a scenario where this is correct.

    @redwizard said:

    We defend our courts...with guns

    Bailiff's sometimes carry guns, more frequently do not. The guys manning the X-ray machine out front I believe generally carry guns.

    @redwizard said:

    We defend our children...with a sign that reads:

    "THIS IS A GUN FREE ZONE."

    ...and then call someone with a gun if there's an emergency.

    You know I constantly get annoyed with people anthropomorphizing stupid things. How can a person be defended by a sign? Hiding behind it maybe?


  • Discourse touched me in a no-no place

    @blakeyrat said:

    No. No we don't. I can't even imagine a scenario where this is correct.

    I've been to offices and factories defended by guns.

    Difficulty: The office buildings were on military bases and the factories built (classified) for the military.



  • Were they actually defended by guns, or were they "defended by guns" because a lot of people on military bases happen to carry sidearms frequently?

    In any case, I guess the Feds have office buildings defended by guns. Difficulty: that's because a bunch of psychos tried blowing those buildings up a few years ago. They never had guns or X-ray machines before Timothy McVeigh. Maybe a kindly old man security guard with a tazer at best.


  • Discourse touched me in a no-no place

    They were defended by guns indirectly because they were within the security perimeter and the guys in gates and perimeter watch are healthily armed and there expressly to shoot unwanted visitors.



  • @blakeyrat said:

    because a lot of people on military bases happen to carry sidearms frequently

    Not US bases. How was the time pod?



  • Are you actually an idiot, or are you just playing one on TV?

    "THIS IS A GUN FREE ZONE" on schools is a statement of the school's policy. That policy is, and this may shock you "This is a gun free zone". Don't bring guns to school.

    You (or your idiot wife, or you idiot wife's friend, I've lost the chain of custody at this point) are implying that all these other places are defended by guns, and we'd defend this with a gun too if it wasn't for that pesky sign.

    And since the implication is that schools should have guns to defend the school with (I can't even begin to fathom the headspace idiocy that statement requires to take seriously)-- then people at school must be armed.

    And I'm saying only a complete and total fucking idiot draws that conclusion, for the raisins stated.


  • Discourse touched me in a no-no place

    @Lorne_Kates said:

    Or hey, how about we just arm EVERYONE!?!

    A consequence of arming everyone (or a substantial fraction thereof) is that the police must be armed at all times while on duty, as there's a relatively high chance that someone being arrested will be armed and willing to use potentially-deadly force. Fortunately that could never ever be a contributory factor to an accident (or “accident”) happening.



  • @dkf said:

    @Lorne_Kates said:
    Or hey, how about we just arm EVERYONE!?!

    A consequence of arming everyone (or a substantial fraction thereof) is that the police must be armed at all times while on duty, as there's a relatively high chance that someone being arrested will be armed and willing to use potentially-deadly force. Fortunately that could never ever be a contributory factor to an accident (or “accident”) happening.

    Umm... whoosh? I literally don't know anymore.


  • Discourse touched me in a no-no place

    @blakeyrat said:

    How can a person be defended by a sign? Hiding behind it maybe?

    Blakeyrat, meet the point. The point, meet blakeyrat.

    There, fixed.



  • @Lorne_Kates said:

    "THIS IS A GUN FREE ZONE" on schools is a statement of the school's policy. That policy is, and this may shock you "This is a gun free zone". Don't bring guns to school.

    Obviously.

    But criminals and the insane also obviously are not following this directive.

    In all the other cases listed above, from the President on down, we have dedicated personnel with guns protecting said people/assets. The President does not carry a gun - but the secret service escorting him does. Celebrities employ people with guns to protect them, even if they don't carry one themselves, as this google search result demonstrates. Etc.

    So I didn't think it would be such a stretch for people to draw the conclusion from my posting that maybe - just maybe - with all the school shootings since Columbine, and given that schools have hundreds if not thousands of children/students attending at a time, that MAYBE it would be a good idea to have a few armed police in the school. That way, the next fuckwit that shows up with a gun and opens up on the student body, maybe we have a few trained good guys on site to immediately respond. Then, instead of 9 or 12 or so people getting killed (never mind injured), we could perhaps cut that number down to one or a few.

    I believe saving a few lives by employing guns in this manner is a good thing. The correlation built into that post was obvious, at least to me. I never thought I'd get called out here for being an idiot based on wild assumptions from a completely unexpected direction. Sorry for wasting everyone's time.

    @Lorne_Kates said:

    Or maybe you'll hire guards? Whose pay will be cut to afford those? Are you hiring bodyguards? Off-duty police officers? Or the same chucklefucks from banks and jewelery stores who, again, are trained to surrender and run rather than start a confrontation? What sort of legal insurance will these assholes have to have to protect them the first time a parent sues because they didn't adequately protect their kid? Forget even letting a kid die. What if one of them is "traumatized" because the guard didn't stop the school shooting fast enough?

    You compare saving some lives to the cost of legal insurance? :wtf:

    If our society has gone that far off the rails, it's no wonder school shootings are becoming more common.



  • @redwizard said:

    You compare saving some lives to the cost of legal insurance? :wtf:

    Have you ever in your life had to deal with school administration? I was not exaggerating when I said they were a bunch of self-serving, ladder climbing, CYA sociopaths. All what it will takes is ONE parent to say the word "lawyer", and the entire school board shits itself. The school will insist every single security guard have "vulnerable sector" insurance (background checks to be around kids)-- police screening, letter of approval from the school board. Extra insurance to operate in a school. The equivalent of "malpractice" insurance to cover being sued by parents.

    Which means the cost will be passed on to the SCHOOLS, in the form of higher costs to hire the security guards. And since schools have NO FUCKING MONEY, it means fewer security guards. So they're effectively uneffective. ~1 security guard to cover a building the size of a security block. I'm sure that'll stop a mass shooter before he takes out a group of students. Or the lone security guard.

    And of course this low paid security guard in a high-stress combat zone will NEVER misuse his gun, as security guards NEVER DO.

    @redwizard said:

    If our society has gone that far off the rails, it's no wonder school shootings are becoming more

    #THAT'S THE ENTIRE FUCKING POINT!

    Maybe, just maybe, even more guns aren't the answer...



  • @Lorne_Kates said:

    the answer

    When you have a better one to propose, let us all know.



  • @redwizard said:

    @Lorne_Kates said:
    the answer

    When you have a better one to propose, let us all know.

    When you want to listen to any of the sane solutions the entire rest of the world have implemented, let us know. (not you personally, even though it includes you personally, but your entire society)



  • @Lorne_Kates said:

    When you want to listen to any of the sane solutions the entire rest of the world have implemented, let us know. (not you personally, even though it includes you personally, but your entire society)

    Citation please.

    Apparently I've been living under a rock on this issue.



  • @Lorne_Kates said:

    Maybe, just maybe, even more guns aren't the answer

    We considered that carefully and decided that you are wrong. But you can't even see how declarations of gun free zones are a bad idea, so we weren't surprised that you we're wrong again.



  • @redwizard said:

    Citation please.

    Sorry, I make it a policy not to argue with the mentally unstable. It's the same reason you can't have a discussion about alcohol with someone who is drunk, or about drugs with someone who is high.

    The gun thread is that way :many_arrows_joke:

    Meanwhile, enjoy regressing into a barbaric culture where everyone is armed and you can't go 12 hours without a mass shooting.



  • @Lorne_Kates said:

    @redwizard said:
    @Lorne_Kates said:
    When you want to listen to any of the sane solutions the entire rest of the world have implemented, let us know. (not you personally, even though it includes you personally, but your entire society)

    Citation please.

    Sorry, I make it a policy not to argue with the mentally unstable. It's the same reason you can't have a discussion about alcohol with someone who is drunk, or about drugs with someone who is high.

    The gun thread is that way :many_arrows_joke:

    Meanwhile, enjoy regressing into a barbaric culture where everyone is armed and you can't go 12 hours without a mass shooting.

    Translation: you have no answers, like the rest of us. QED. I agree with you on one thing: we're done here.

    Also, the mentally unstable have already taken over. We are the minority. This is where democracy fails - when the lunatics run the asylum.

    EDIT:
    @Eldelshell said:

    why all this drama? You people take this place too seriously.

    +1


  • Discourse touched me in a no-no place

    @boomzilla said:

    But you can't even see how declarations of gun free zones are a bad idea, so we weren't surprised that you we're wrong again.

    It's simple. It's clear that the only valid reason for bringing guns into a school is for shooting the administrators — the teaching staff would unite behind that idea in a moment — so of course the administrators put up signs declaring the school to be a gun free zone! :smiley:

    Always take the most stupid and cowardly option as your explanation. Occasionally you're wrong, but then you feel better about humanity…



  • Well, office politics are exactly that: politics. It's hard to have a sane discussion with your boss or boss+1 if it comes to 'their baby'.

    I'd suggest you try to convince them to use what you think is best suited for the job, but if you're overruled: suck it up and do your job. Just make sure that your estimations, predictions and timelines reflect the consequence of not using the best tool for the job.

    Completely ignoring your boss or corporate standards will have repercussions for you: in the best case it will be a friendly chat ('Hey Buddy, next time use the tools provided'), in the worst case you won't get promoted or might even get fired. It's not worth losing your job over something like this.

    But while you're at it: go look for a job where more sane people work.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.