New around here? Register your SA Forums Account here!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Bloody
Mar 3, 2013

why is method input validation so verbose in c#

im tired of dealing with

void foo(object bar, object baz) {
if(bar == null) {throw new argumentnullexception(nameof(bar));}
if(baz == null)...

why did they remove the [notnull] attribute

why isnt there a less annoying syntax for this

yes i could write some stupid helper extension methods but thats not the point

Adbot
ADBOT LOVES YOU

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
i think they removed the attribute because instead you can just just use object! and it not being null is actually enforced

Bloody
Mar 3, 2013

wait what

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
just like you have nullable value types like int?, you have non-nullable reference types like string!

akadajet
Sep 14, 2003

Jabor posted:

just like you have nullable value types like int?, you have non-nullable reference types like string!

that's an optional c# 8 thing that just came out and you know that

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
i remember them talking about it for 7, did it end up getting punted?

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
I'm not usually one to make fun but

ratbert90 posted:

I did a small interview for Amazon and apparently failed the coding test?

Apparently, it wasn't O notation enough?

*edit*

The exercise was:
Make a function that, given a string with brackets in it returns true if the string has the same order of closing brackets.
IE:
"{$$[fdasfsa<fdaf>####]%@#}" == True
"{$$[ff}fff]" == False

My solution was to parse the string and dump the opening and closing brackets into separate arrays, and then
loop through said arrays to make sure that the opening bracket array matched the closing bracket array.

I'm sure there's a way more clever solution with recursion or some poo poo they wanted, but w/e. :shrug:

isn't this guy the one who casually admitted to farming his job out to a team of cutrate Brazilian programmers without telling his employer? did he really think he could run that con on Amazon?

pseudorandom
Jun 16, 2010



Yam Slacker

Ciaphas posted:

I've not encountered this professionally, somehow, so I'll just ask


when you've got a bug like this that you think you've put in enough defensive code to prevent relapse, BUT for whatever reason you can't reproduce the original bug in the first place, how is my time best spent going forward

- find the drat bug come hell or high water, doesn't matter how unlikely it is to produce in the Real World
- code defensively, put in traces, keep an eye out, and hope like hell it doesn't happen again while I get some other work done


I guess this is more a 'depends on your manager' question, huh

Much like others have said, option 2. I've encountered bugs like that a few times in my somewhat limited professional experience, and that's generally the best answer. First, if you try to focus all of your energy on a bug and track it down like Moby-Dick, you're just going to start being blind to issues and will essentially burn out on it, thus wasting most of the effort you put in on it. Second, if you think there's a chance you fixed it via option two, then at least deploy it and see if occurrences of the bug decrease in frequency (:rip: if they increase); hopefully you have some kind of logging or error reporting that will let you see crash frequency and core dumps etc.

Basically, once you've accomplished option 2, which I think is generally a subset of option 1, then you should just work until you feel like you're literally just guessing. Once you're there, as frustrating as it may be, it's time to step back and focus on something else to clear your mind's palette. If the bug keeps occurring, then, hopefully thanks to option 2, you'll have more diagnostic data available AND a fresh, relaxed pair of eyes when reviewing the bug areas again.

eschaton
Mar 7, 2007

the knowledge knower. a wisdom imparter. irritatingly self-assertive. odorous.

CRIP EATIN BREAD posted:

ctps: wanted to use some third party application that only supports a few auth mechanisms one of which was LDAP, so I wrote up a small server based on apache ds to implement my own in-memory LDAP to fake LDAP bind auth requests and hit the database to check the username/password hash.

slick

gonna do radius next?

eschaton
Mar 7, 2007

the knowledge knower. a wisdom imparter. irritatingly self-assertive. odorous.

Ciaphas posted:

oops did that thing where i ramble mostly to myself in a post

well, useful notes for tomorrow at least :D

it’s interesting too

don’t undersell thyself

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat

jit bull transpile posted:

I'm not usually one to make fun but


isn't this guy the one who casually admitted to farming his job out to a team of cutrate Brazilian programmers without telling his employer? did he really think he could run that con on Amazon?

i mean its amazon who cares?

ripping off your employer is the most american thing.

pseudorandom
Jun 16, 2010



Yam Slacker

jit bull transpile posted:

I'm not usually one to make fun but


isn't this guy the one who casually admitted to farming his job out to a team of cutrate Brazilian programmers without telling his employer? did he really think he could run that con on Amazon?


The correct answer is to pipe the string queries into an Amazon SQS queue, which is read by an Amazon Lambda serverless script, which then uses Mechanical Turk to have people balance the brackets. Then, you sell this Bracket Balancing as a Service online, and charge the interviewer $0.0001 for each of their queries.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

pseudorandom posted:

The correct answer is to pipe the string queries into an Amazon SQS queue, which is read by an Amazon Lambda serverless script, which then uses Mechanical Turk to have people balance the brackets. Then, you sell this Bracket Balancing as a Service online, and charge the interviewer $0.0001 for each of their queries.

hired

gonadic io
Feb 16, 2011

>>=
Amazon Turk is cool http://mattrichardson.com/Descriptive-Camera/

Progressive JPEG
Feb 19, 2003

Ciaphas posted:

when you've got a bug like this that you think you've put in enough defensive code to prevent relapse, BUT for whatever reason you can't reproduce the original bug in the first place, how is my time best spent going forward

- find the drat bug come hell or high water, doesn't matter how unlikely it is to produce in the Real World
- code defensively, put in traces, keep an eye out, and hope like hell it doesn't happen again while I get some other work done


I guess this is more a 'depends on your manager' question, huh

add a bunch of debugging info then wait for a repro when you'll then hopefully have more clues/context. ideally you'd want to dump as much state as possible so that you can reconstruct what else was happening at the time

50/50 it'll end up being something totally unrelated to what you thought it was

collecting information is an underutilized but critical part of solving problems

raminasi
Jan 25, 2005

a last drink with no ice

Bloody posted:

why is method input validation so verbose in c#

im tired of dealing with

void foo(object bar, object baz) {
if(bar == null) {throw new argumentnullexception(nameof(bar));}
if(baz == null)...

why did they remove the [notnull] attribute

why isnt there a less annoying syntax for this

yes i could write some stupid helper extension methods but thats not the point

if you’re on c# 7 you can do
C# code:
bar = bar ?? throw new ArgumentNullException(nameof(bar));

necrotic
Aug 1, 2005
I owe my brother big time for this!
ctps Your job ran 418 tests with 69 failures

trying to get 2 more passing tests in there

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


cjs: boss seems ok with me punting on the irreproducible bug from yesterday, long as my "story" (guess I gotta do a JIRA ticket? half day today so I'll inquire tomorrow) about what's likely going on and my proposed defenses and traces pass the change control board

so uh, yay, thanks for the advice :toot:

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

jit bull transpile posted:

I'm not usually one to make fun but


isn't this guy the one who casually admitted to farming his job out to a team of cutrate Brazilian programmers without telling his employer? did he really think he could run that con on Amazon?

i think ratbert was the embedded programmer who finally quit their abusive below-market-rate job a few months back and then their former employer basically went into crisis because ratbert was the only programmer they had left at the time

MononcQc
May 29, 2007

Ciaphas posted:

cjs: boss seems ok with me punting on the irreproducible bug from yesterday, long as my "story" (guess I gotta do a JIRA ticket? half day today so I'll inquire tomorrow) about what's likely going on and my proposed defenses and traces pass the change control board

so uh, yay, thanks for the advice :toot:

it's okay, you'll work on something unrelated and a few weeks from now a random idea will come and you'll figure out most of it without explicitly thinking about it, just by soaking in that environment and having it in the back of your mind.

Zlodo
Nov 24, 2006

Ciaphas posted:

I've not encountered this professionally, somehow, so I'll just ask


when you've got a bug like this that you think you've put in enough defensive code to prevent relapse, BUT for whatever reason you can't reproduce the original bug in the first place, how is my time best spent going forward

- find the drat bug come hell or high water, doesn't matter how unlikely it is to produce in the Real World
- code defensively, put in traces, keep an eye out, and hope like hell it doesn't happen again while I get some other work done


I guess this is more a 'depends on your manager' question, huh

i either do the second one, close the jira with a reference to the CL, then wait and see if qa reopens it
or if it concerns something where lots of adjacent changes/fixes have happened since the tested version I close as "cannot reproduce" and comment "probably fixed by cl XYZ please reopen if this still happens in a newer build that includes this cl"

it also depends on which kind of product you are working on and on how bad it would be if that bug were to end up in production

gonadic io
Feb 16, 2011

>>=
I'm looking at a program that requires jvm 10+ to run. To run, not to compile. any idea how somebody managed this?

mystes
May 31, 2006

gonadic io posted:

I'm looking at a program that requires jvm 10+ to run. To run, not to compile. any idea how somebody managed this?
Maybe I'm misunderstanding something because I'm not very knowledgeable about Java, but why is this surprising?

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
yeah, if the code uses any of the new stuff in java 10s standard lib then it'll require java 10

Aramoro
Jun 1, 2012




Yeah all you'd need would be a new fangled Local Type Interface and it'll need Java 10. E have to move to Java 10 in January for reasons and our code will very quickly become non backwards compatible. The day we de-supported WebSphere I wrote some Java8 in celebration.

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
if you are talking about local type inference that actually doesn't require anything new in the JVM. its purely syntatic sugar.

mystes
May 31, 2006

In general it seems like maybe backwardly compatibility with earlier JVMs isn't a huge concern for them based on how the language is being developed now. I guess it's the same thing with .net where when the assumption was that only one runtime would be installed on every computer it was extremely important, but now that they're moving to a model where the runtime is distributed with applications they can pretty much do whatever they want.

Although I guess some of the changes they made to stuff like reflection were actually much worse than anything .net has done. I think .net has generally avoided any changes that would make existing code stop compiling despite internally changing a lot of things in .net core to use stuff like spans.

mystes fucked around with this message at 20:33 on Jun 19, 2019

Fiedler
Jun 29, 2002

I, for one, welcome our new mouse overlords.

mystes posted:

I think .net has generally avoided any changes that would make existing code stop compiling despite internally changing a lot of things in .net core to use stuff like spans.

.net core 1.0 made a lot of breaking changes versus .net framework. the internal feedback was "don't do that, that's stupid." then the external feedback was "why did you do this? porting existing code to .net core 1.0 is annoying as gently caress." and so a large part of .net core 2 was undoing the stupid decisions made for .net core 1.0.

mystes
May 31, 2006

I guess I forgot how bad .net core 1 was. Now that I think about it, I did have problems like methods from .net framework randomly not existing, which was annoying because IIRC even if you were looking at the .net core docs online the examples would still be the same as the .net framework ones and might not even compile.

I don't think I've had that sort of problem with .net core 2 at all.

Bloody
Mar 3, 2013

.net core 1 seemed super rushed and half-baked tbh

gonadic io
Feb 16, 2011

>>=

mystes posted:

In general it seems like maybe backwardly compatibility with earlier JVMs isn't a huge concern for them based on how the language is being developed now. I guess it's the same thing with .net where when the assumption was that only one runtime would be installed on every computer it was extremely important, but now that they're moving to a model where the runtime is distributed with applications they can pretty much do whatever they want.

Although I guess some of the changes they made to stuff like reflection were actually much worse than anything .net has done. I think .net has generally avoided any changes that would make existing code stop compiling despite internally changing a lot of things in .net core to use stuff like spans.

I thought there was a big thing that bytecode was extremely backwards compatible? Why the gently caress are there still the nongeneric collections then?

Fiedler
Jun 29, 2002

I, for one, welcome our new mouse overlords.

Bloody posted:

.net core 1 seemed super rushed and half-baked tbh

yeah. and that despite shipping many, many months behind schedule.

my homie dhall
Dec 9, 2010

honey, oh please, it's just a machine

gonadic io posted:

I thought there was a big thing that bytecode was extremely backwards compatible? Why the gently caress are there still the nongeneric collections then?

it’s forwards compatible :)

akadajet
Sep 14, 2003

Bloody posted:

.net core 1 seemed super rushed and half-baked tbh

but now .net core is good and getter better with 3

eschaton
Mar 7, 2007

the knowledge knower. a wisdom imparter. irritatingly self-assertive. odorous.
I spun up a beefy Fedora Server 30 instance at my hosting and set up OpenCyc 4.0

that required installing OpenJDK 1.8, which was the closest to the version of Java with which it claimed to be compatible (1.6, 1.7)

on the plus side, Cyc is pretty zippy on this instance and also has a Lisp running atop the JVM that it’s actually implemented with

distortion park
Apr 25, 2011


Bloody posted:

.net core 1 seemed super rushed and half-baked tbh

the whole thing sucked. they briefly had some lovely json project/reference file thing as well. fortunately they fixed that with the new xml one.

Bloody
Mar 3, 2013

akadajet posted:

but now .net core is good and getter better with 3

ya i am excited for when we try to migrate our giant legacy app to .net 5. at least were on 4.5.something how hard could it be

Aramoro
Jun 1, 2012




eschaton posted:

beefy Fedora

Linux Distro version names are getting out of hand.

animist
Aug 28, 2018

Aramoro posted:

Linux Distro version names are getting out of hand.

i wasnt aware "throbbing" was the name of a toy story character but i guess you do you, debian

Adbot
ADBOT LOVES YOU

Soricidus
Oct 20, 2010
freedom-hating statist shill

mystes posted:

In general it seems like maybe backwardly compatibility with earlier JVMs isn't a huge concern for them based on how the language is being developed now. I guess it's the same thing with .net where when the assumption was that only one runtime would be installed on every computer it was extremely important, but now that they're moving to a model where the runtime is distributed with applications they can pretty much do whatever they want.

they've literally moved to a model where they are just going to automatically increment the bytecode version number in every new jvm release, even if they haven't changed any aspect of the bytecode at all. that's how few fucks they give now.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply