Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

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
NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

cool av posted:

how do ppl fee about http clients throwing exceptions on non-2xx responses? I’m leaning toward I don’t like it.

i disapprove too

exceptions work best for errors that can't be pinned down to a specific function call - out of memory (including stack overflows), out of storage, lost permissions, lost connection to the db... nasty failure modes, where the least bad option is a high-level catch statement that aborts the whole operation and maybe goes for a retry

if the error is very clearly and very predictably tied to a single line of code, like httpclient.postAsync() or json.deserialize(), then returning an error value is pretty much strictly better. using try/catch around a single line of code is analogous to using an if/switch/match on the result value, except uglier, slower, and more error prone

Adbot
ADBOT LOVES YOU

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Cabbage Disrespect posted:

what's that, you say? non-deterministic classpath issues? sometimes a method wants a javax.ws.Thing but we feed it jakarta.ws.Thing and sometimes vice-versa? very cool.

here's a nickel dude, go buy yourself a quay.io/keycloak/keycloak:23.0

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

redleader posted:

x postin because im still mad about this. the .net date/time types are absolute trash and they should just do what java did and steal the good date/time library outright

system.datetime is only suitable for poo poo code that never leaves your timezone and should come with a compiler warning for using it at all. it's on the same level as hardcoding user-facing strings or writing non-responsive UIs. if you get a datetime from a library, *immediately* convert it to a datetimeoffset

system.datetimeoffset is decent

i'll still install nodatime on any project that i actually give a poo poo about, but now that they've finally added DateOnly and TimeOnly types it's less mandatory

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

redleader posted:

row polymorphism is at least a decade away from hitting any sort of normie- or normie-adjacent lang. you can quickly tell because a quick goog search only returns a bunch of comp sci theory blogs and papers

typescript literally has row polymorphism right now dude

JavaScript code:

function add<T extends  { A : number, B : number }>(x : T) : { C: number } & Omit<T, "A" | "B"> {
    let { A : a, B : b, ...rest } = x;
    return { C : a + b, ...rest };
}

let { C : three, X : x, Y : y } = add({ A: 1, B: 2, X : "", Y : ""});
let { C : thirty, Z: z } = add({ A: 10, B: 20, Z : ""});


omit<T, "list of destructured fields"> is the statically-checked type of 'rest'

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

VikingofRock posted:

Is the "...rest" here needed as part of the definition of row polymorphism? I'm asking because I'm wondering if C++ would count as row polymorphic with something like this:

i think the copy constructor is performing the same role as "rest" here, that is preserving the fields you don't care about unaltered into the return value - which is the bare minimum to be considered RP

(in more high-level languages you do RP with records so the constructor is implied by that restriction)

though, RP can also include the more powerful ability to add/drop fields from a record while preserving the others. purescript can do it (i think this is where I first encountered it, and i thought it was a requirement to be RP), and now typescript can too

i imagine c++ might be able to do it with a lot of template fuckery - you need to encode a relationship between the constructors of different types.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Subjunctive posted:

write an `equals_ignoring_timestamp` method and move on with your life

the annoying issue, mr. president, is that when someone adds another field to the struct, they will get exactly zero warnings from the compiler that somewhere in the codebase there is an "equals_ignoring_timestamp" method that compares 9/10 fields and now you just made it 9/11 whoops

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Subjunctive posted:

that’s OK, the tests will break

mein führer...

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

I've never rolled back in prod either, and if I had to it would definitely warrant a postmortem

but knowing that I *could* gave me that little extra feeling of safety, so imo it was well worth the three minutes it took to write an ALTER TABLE or two for the rollback statement

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

my homie dhall posted:

if you hate migrations so much seems like you could create a new table for each version of your schema? I work on fake things which are allowed to have downtime, so I just do migrations

even better, make sure your schema is in sixth normal form and your migrations well never need locks

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

advertising is negative-sum economic activity

bitcoin may cause the extinction of sixteen species to transfer one dollar, but at least a money transfer and account balance is a useful thing that people want

advertising is literally paying to make other people unhappy

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

mystes posted:

Handling resizing in vb6 sucked because IIRC you had to handle it manually in code, whereas in modern winforms there are actual layout controls that will handle it for you which makes it a million times easier.

had to handle resizing in a winforms app, vbnet not even vb6, can confirm it sucked balls

you had a few basic anchoring flags but otherwise it was lots and lots of code in the Resize handler where you had to do manual pixel math

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

ChickenWing posted:

jesus christ how horrifying

we eventually got to something pretty similar with emscripten and later wasm

"i have a bunch of code that needs to be written in a Serious Language(tm) but must also run on the most universal client available" isn't a problem that's going to go away

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

finally, i can run clojure in the browser

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Sagacity posted:

Pro-tip (coming from a bunch of experience, ymmv): Consider how much time you'd have to spend on writing the transforms manually. I bet it is going to be less than the time you'd be spending configuring tools to 'magically' transform objects and keeping those dependencies updated.

This. Also, if your language is strongly typed and all constructor parameters are mandatory, you can let Copilot write the basic "x.Foo = y.Foo" stuff fairly safely.

Then you'll have a bunch of boring, repetitive, but valuable code - valuable because it will break with a compiler error when there's a change on either side of the data flow that you need to consider.

It's much better than adding a new field to the domain object and have that magically and silently appear in the DTO even though the service on the other side has not been updated to handle it!

Also, code organisation suggestion: there is only one pure domain object for business logic, but potentially many DTOs for different targets. So don't add "toSqlDto" and "fromSqlDto" methods to your domain object, instead add "toDomain" and "fromDomain" methods to each of your DTOs. Keep the dependencies one-way.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Its a Rolex posted:

the project i work on is built around 365 days in a year (or more specifically, 8760 hours in a year). the idea of a leap day breaks the entire thing at a very fundamental level. 8760 was a magic number sprinkled everywhere in the code when i started, and now it's just burned into my brain as somewhat-useful trivia

curse those obscure edge cases! who could possibly have foreseen them

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

necrotic posted:

I think this is a neat solve and also a very glad it’s not my problem.


it being leap smearing which you didn’t explicitly mention

im very glad we've found a way to deal with leap seconds and our time libraries can be stable for the foreseeable future






On 18 November 2022, the General Conference on Weights and Measures (CGPM) resolved to eliminate leap seconds by or before 2035. The difference between atomic and astronomical time will be allowed to grow to a larger value yet to be determined. A suggested possible future measure would be to let the discrepancy increase to a full minute, which would take 50 to 100 years, and then have the last minute of the day taking two minutes in a "kind of smear" with no discontinuity.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Antigravitas posted:

I normally write in Python 3, and we are pretty good at moving to new versions.

Right now, I have to use Javascript. ES5.

This is torture. Absolute torture. I hate everything about this. I don't even have a debugger. TypeError: undefined not callable (property 'includes' of [object Array])' go gently caress yourself Javascript not even a line number what the poo poo aaaaagh

I know you may not have full control of the toolchain, but isn't this exactly what Babel was made for?

e: babel won't give you a debugger but if you are able to write in typescript that takes care of most of those dumb "object does not have this particular property/method" time-wasting errors

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Private Speech posted:

I was reading about planning poker since it came up itt recently and I really enjoyed this cop out bit

which basically boils down to "bollocks bollocks management get veto"

is that specific quote about planning poker? because "veto power" only makes sense in a yes/no vote

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Subjunctive posted:

veto doesn’t need to have anything to do with a vote, it’s just the ability to prevent an action, like “making 5 days the recorded estimate”

ok then what happens after they use the veto?

if the estimate goes back to the devs, it's a useless veto (the devs have no reason to back down to break the stalemate, it's the managers who need to deliver)

if it goes to managers, it's not a veto and it contradicts the previous sentence (that managers don't vote)

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Deep Dish Fuckfest posted:

just looked at the jpeg xl github and i hate their logo and i hate the whole thing on that basis alone. also the logo is in svg; way to have faith in your own format

from your description i was expecting some imagemagick-style "graphic design is my passion" embarrassment. it's just extremely basic and i do not understand how it could have made you so mad

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

the XML serializer in c# does have a magic attribute that is supposed to mean "when deserializing, check the value of this field to decide which subclass to target"

i never got it to work and just wrote a switch instead

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

toiletbrush posted:

Its still 1000x less evil than the repo at current job where they decided to use C#'s implicit operator to do all the mapping

nah, not really. an implicit operator is still type-safe and debuggable

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Bloody posted:

I just use fork and it’s so good at git that I haven’t needed the terminal in years.

:emptyquote:

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Corla Plankun posted:

people who can't figure out/tolerate cli git should be more embarrassed imo

ah yes, the cli interface that has stood as the arch-example of inconsistent design and crappy ux for two decades

people should definitely make a point of pride of using that. perhaps also relying on nothing but their own wits and the official man pages, which have also been a long-running joke of awkwardness

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

I had the displeasure of using TFS and it had "shelving". Jetbrains has been around since 2000, perhaps all those weird terms predate git and when they added git support they decided to keep the pre-existing names for the features supported by multiple VCSes?

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

dilbert is actually very proud of his strobe tie, thank you

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Ultrapotassium posted:

What's the alternative here, throwing an exception on the child thread?

In really old c#, before Tasks let alone async/await, this was not uncommon. You'd fire off your async job by starting a full fat System.Threading.Thread, at which point it was very tempting to just call Abort() whenever the user clicked Cancel or such.

Even in the One Direction years this was known as very bad practice. The MSDN article on Thread.Abort() is a giant list of ways it can gently caress up, and they finally killed the method for good in .NET 5 (something something abortion joke)

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

bob dobbs is dead posted:

too many peeps know the fate of griswold and volrath cast iron pans for that to happen, i think

ironically that *is* something that a subscription model solves, however loathsome it may be

when I recently moved to a new city I got a swapfiets subscription bike for a while. guess what? it was built like a loving tank, because maintenance was a cost and not a revenue source for the vendor

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

i naively thought certification meant "you can sue us for damages if there's an undocumented bug (and it did enough damage to be worth litigating)"

is it actually just vibes?

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt


NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Bourricot posted:

I feel seen. on my previous project, we had 66 repos for a team of 5 devs (the company standard was 2 repos: 1 frontend, 1 backend)
they're starting work on a "micro-frontend" :latestfad: (so the tech lead can pad his resume)

not quite that bad but at my old job, when I got to lead my first product, I did make three repos for backend, web frontend, and android app

in my naive youth I believed the ceo when he said that we'd be open to third-party clients, so I wanted teams to treat the openapi contract as ironclad and carefully versioned, while still being able to work at their own paces given the different team sizes

of course nobody ever cared about making a client and the team never grew big enough that they wouldn't fit into a large room, so it was 100% pointless overhead. but even if that hadn't been the case, the CI check for changes in the generated openapi.json was what actually helped to limit accidental breaking changes, and it would have worked just as well in a monorepo

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Powerful Two-Hander posted:

it's pretty common for corps to try and put a "code escrow" clause in with the theory being that if you go under they could somehow continue to use the product by building and deploying from scratch. I always used to say "lol, lmao" to this and be like "guys we can barely build our own code this is insane" but they'd insist and the vendor would just shrug and go "ok that's another 10k though" and ofc now everything is deployed to 900 billion different Aws components it's even less likely that it would be possible to ever do this so I just tell them to drop the clause entirely.

for an opposing view - and I must disclaim that my experience is with European SMEs rather than megacorps - code escrow is something I actively pushed for as a developer because I believe it's one of the very rare instances where corporate interests and good SWE practices can align, so it should be encouraged as much as possible

typically nobody gives a drat how annoying or brittle your build is as long as they get the shipped artifact, and when you log hours for ci/cd work or documentation they act like you made that poo poo up. so having an actual contractual term that justifies that expense is a good thing

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

we started being stricter with the hell customer and turning every one of their "just make it X" tickets into accurate specs with realistic estimates through painstaking q&a sessions (which frequently find out that the request didn't make any sense in the first place)

now they say they're unhappy about the hours it takes to figure out the exact specs and estimates. the compromise our manager reached is that for every off-the-cuff "make it X" ticket we will give an equally off-the-cuff "it could take 2 days or a week, maybe" estimate, and the hell customer will decide if they want to put in the time to actually figure out what they want

:ughh:

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

when i encountered that style of writing in the wild for the first time - blissfully unaware of its origin - i remember thinking, how much of a pompous blowhard do you have to be to preface 'as a developer...' to every one of your mundane-rear end tickets asking for a new command-line flag

Adbot
ADBOT LOVES YOU

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

raminasi posted:

where this gets wrinkly is when the thing you're trying to figure out is how to surface errors to the end user in the first place, and they have no idea why you want to do that, because no errors should ever be possible. why are you writing the application so it can have errors? aren't you good at your job?

tell them a cosmic ray flipped the sign in the field

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