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 $10! We charge money because it costs us money per month for bills alone, and since we don't believe in shady internet advertising, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Osmosisch
Sep 9, 2007

I shall make everyone look like me! Then when they trick each other, they will say "oh that Coyote, he is the smartest one, he can even trick the great Coyote."



Grimey Drawer

Powerful Two-Hander posted:

babby two hander coming on the scene.



Congratulations! I hope they either learn to make equally entertaining posts, or a better job selection strategy :toot:

(Seriously thanks for your stories, they've brought me and the off-site friends I send them to a lot of joy)

Adbot
ADBOT LOVES YOU

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

DrPossum posted:

just go read the code


pls dont advocate self harm

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.



Osmosisch posted:

Congratulations! I hope they either learn to make equally entertaining posts, or a better job selection strategy :toot:

(Seriously thanks for your stories, they've brought me and the off-site friends I send them to a lot of joy)

oh no I didn't realise people were actually reading my posts, how embarrassing

there's poop everywhere, nothing approaching coherent language and the screaming doesn't stop so basically parenting is just like using javascript

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

Powerful Two-Hander posted:

oh no I didn't realise people were actually reading my posts, how embarrassing

there's poop everywhere, nothing approaching coherent language and the screaming doesn't stop so basically parenting is just like using javascript

:hmmyes: + :yosnice:

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

DrPossum posted:


also spring is loving garbage
this statement is factually incorrect

spring is certainly bloated and fairly complex, but so is any other framework once you start adding features you actually need

regarding java though, i really hope they get project loom out the door sooner rather than later because the true garbage is reactive programming. async/await in general is loving garbage but on the JVM Rx is garbage. Webflux is garbage. Kotlin coroutines are garbage.

Xarn
Jun 26, 2015

Plorkyeran posted:

i graduated over a decade ago and almost all of my classes which involved writing code for homework required using svn. whatever was committed to your repo at the homework deadline was the thing that got graded. one class did literally have "did you run the auto-formatter?" as part of the homework grade. there were a few which automatically ran the test suite which you had to pass each time you committed something to svn.

This but git & gitlab when I was teaching.

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.




I'm kidding of course, children grow up and mature, js does not.


this library (setCola) is actually really neat though, it applies ontop of the equally cool cola js plugin for d3 and lets you express constraints on a graph without having to hand janitor positions which is essential if you're generating a directed graph dynamically and don't know the size or layout in advance (and can't easily compute it because the graph build zig zags up and down the tree)

this is actually really just a stubborn side project to generate visual models of our reference data which is way harder than it seems because of the graph size being so variable (e.g. for two entities you might get 100 nodes within 3 hops or 500), also nodes can have multiple incoming/outgoing links to each other so a top down tree just doesn't cut it.

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.



speaking of jobs, lmao

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

code:
TJisMassegggge is W403 Forbidden
i need to be more careful with my units

hobbesmaster
Jan 28, 2008

Powerful Two-Hander posted:

speaking of jobs, lmao



does it just return status 451

Sapozhnik
Jan 2, 2005

Nap Ghost
async/await should only be used in user interfaces, or perhaps in the implementation of an http or websocket deframer.

If you are going to turn a call stack into a heap allocated call tree then maybe think carefully about whether or not this is a good idea.

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.



hobbesmaster posted:

does it just return status 451

idk about you but it's giving me a 413 :smuggo:

e: or maybe actually :reject:

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

Powerful Two-Hander posted:

idk about you but it's giving me a 413425

NihilCredo
Jun 6, 2011

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

quote:

idk about you but it's giving me a 411 :suicide:

AnimeIsTrash
Jun 30, 2018



PokeJoe posted:

Java...is good

It's pretty okay OP. I like being paid money for coding in it.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

DrPossum posted:

also spring is loving garbage
it's better, and better documented, than what a random company is likely to build on its own, which is the point

spring services were a beacon of sanity in Amazon Fulfillment, which was otherwise built on a morass of C++97 whims

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
and they weren't even using the REST parts of spring, just the dependency injection and hibernate

darkforce898
Sep 11, 2007

Sapozhnik posted:

async/await should only be used in user interfaces, or perhaps in the implementation of an http or websocket deframer.

If you are going to turn a call stack into a heap allocated call tree then maybe think carefully about whether or not this is a good idea.

Async and await are the worst. I don't understand what's so hard about either making two functions, one that blocks and then one with a callback. You could even just make it a single function that takes a nullable function as the callback.

I end up just writing

await x =
await y =
await blahgarbage

I fail to see how this is better. But I fail to see a lot so it may just be me.

mystes
May 31, 2006

darkforce898 posted:

Async and await are the worst. I don't understand what's so hard about either making two functions, one that blocks and then one with a callback. You could even just make it a single function that takes a nullable function as the callback.

I end up just writing

await x =
await y =
await blahgarbage

I fail to see how this is better. But I fail to see a lot so it may just be me.
I think in most languages with async stuff you are free to use explicit callbacks rather than await if you prefer that (and await is usually effectively like syntactic sugar for callbacks), so if there's a blocking version and an async version you already have "two functions, one that blocks and then one with a callback."

Sapozhnik
Jan 2, 2005

Nap Ghost
Because then you end up with an incomprehensible mess of endlessly nested callbacks, async/await was a direct response to what you are proposing.

Instead of writing

code:
function foo(param, callback) {
  step1(param, result1 => {
    step2(result1, result2 => {
      step3(result2, result3 => {
        callback(result3);
      });
    });
  });
}
you write

code:
async function foo(param) {
  const result1 = await step1(param);
  const result2 = await step2(result1);
  const result3 = await step3(result2);

  return result3;
}
...and the first example doesn't even handle errors, whereas the second one does.

The problem is that a bunch of languages have an "async/await" syntax, and the syntax is usually more or less the same but the actual underlying concurrency model in each language is completely different. JavaScript uses promises, Python I think uses generators, Rust uhh... I think uses promises but different in that they don't actually start executing until you tug on the result of the outermost asynchronous function.

Sapozhnik fucked around with this message at 23:34 on Oct 17, 2021

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
swift is adding async/await and I don't really care syntactically, but the task stuff that came with it looks a+

also clang can now warn when your objc method doesn't call a completion block on all code paths and that is an excellent feature

Plorkyeran
Mar 21, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
swift async/await is great for ui/mainactor stuff but every example of using it that i've seen which doesn't involve that has just made me go "that could have just been a normal synchronous function call"

darkforce898
Sep 11, 2007

Why do I have to explicitly mark it synchronous. All of programming ever has been synchronous. If you have a bunch of lines in a row that are synchronous then why not reverse it.

I would much rather explicitly mark my ui stuff as non blocking instead of having to make every single backend call blocking

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
what do you mean by "explicitly mark it synchronous"? that's not at all what await does, and i'm not sure what else you could be referring to

mystes
May 31, 2006

darkforce898 posted:

Why do I have to explicitly mark it synchronous. All of programming ever has been synchronous. If you have a bunch of lines in a row that are synchronous then why not reverse it.

I would much rather explicitly mark my ui stuff as non blocking instead of having to make every single backend call blocking
It sounds like you might be confused. However, it's true that async stuff can add additional complexity when you don't actually need to do things asynchronously.

FlapYoJacks
Feb 12, 2009

DOES NOT OWN EXOTIC FISH
Django > Spring. If you aren’t inheriting a Spring project there is no reason to choose it over Django unless you like pain.

redleader
Aug 18, 2005

Engage according to operational parameters
sure, i'm just gonna choose to use python when not absolutely required

FlapYoJacks
Feb 12, 2009

DOES NOT OWN EXOTIC FISH

redleader posted:

sure, i'm just gonna choose to use python when not absolutely required

As you should. It’s far better than Java.

Shaggar
Apr 26, 2006
no its not. its also a pointless comparison cause c# and asp.net are better than both by miles

cowboy beepboop
Feb 24, 2001

DoomTrainPhD posted:

Django > Spring. If you aren’t inheriting a Spring project there is no reason to choose it over Django unless you like pain.

django is a nice project but still suffers from way too many runtime errors like all python programs

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

Shaggar posted:

no its not. its also a pointless comparison cause c# and asp.net are better than both by miles
I wouldn't go that far, but it's definitely miles better than python and django. C# and asp.net have been doing a few too many reboots of their stack over the years though, perhaps i will revisit once things settle down a bit. the strong backwards compatibility is something I enjoy in java.

but sure if at some point my application is running the risk of becoming too performant or too multi-core saturating I'll try python then

Sagacity fucked around with this message at 07:22 on Oct 18, 2021

DrPossum
May 15, 2004

i am not a surgeon

Sagacity posted:

I wouldn't go that far, but it's definitely miles better than python and django. C# and asp.net have been doing a few too many reboots of their stack over the years though, perhaps i will revisit once things settle down a bit. the strong backwards compatibility is something I enjoy in java.

but sure if at some point my application is running the risk of becoming too performant or too multi-core saturating I'll try python then

lol Microsoft is just loving reboots all the way down forever

toiletbrush
May 17, 2010

Sapozhnik posted:

Because then you end up with an incomprehensible mess of endlessly nested callbacks, async/await was a direct response to what you are proposing.

...and the first example doesn't even handle errors, whereas the second one does.
This, and also the fact that writing code that uses a callback/completion handler 'infects' the call stack in exactly the same way as making a method async, the difference is async/await gives you a nice escape hatch:
code:
public string SyncMethod() 
{
    return poop.fartAsync().Result
}
The main bad thing about async/await in C# is that wrapping the result in Task<TResult> makes method signatures a little funky, but that's an implementation detail

floatman
Mar 17, 2009
Async await is

code:

await Task.WhenAll(allUrShit);

Wow many processes fast code best devs

cool av
Mar 2, 2013

i never dug into exactly why, but among all the other crap asp.net core ‘borrowed’ from node/express is the inability to just write synchronous request handlers. direct translation from asp.net into netcore runs like poo poo under load unless you also change all your db calls from xyz() to await xyzAsync()

Sapozhnik
Jan 2, 2005

Nap Ghost
yeah backend async/await is bad in most situations, don't use it

in user interfaces it's nice tho

NihilCredo
Jun 6, 2011

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

Plorkyeran posted:

swift async/await is great for ui/mainactor stuff but every example of using it that i've seen which doesn't involve that has just made me go "that could have just been a normal synchronous function call"

Sapozhnik posted:

yeah backend async/await is bad in most situations, don't use it

in user interfaces it's nice tho

you're the second guy that says that async should stay in ui land and backend code should be synchronous and it baffles me

like, don't you ever send emails from your backend (with or without an email service)? you don't upload files? you don't run complex queries that take a second or more from your dedicated database server? do you just buy the biggest 512-core server your employer's money can buy and let half of those threads spin while waiting for the external service to complete the request?

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

NihilCredo posted:

do you just buy the biggest 512-core server your employer's money can buy and let half of those threads spin while waiting for the external service to complete the request?
don't tell anyone, but you can actually have more than one thread per core

so just have a big thread pool per core, no muss no fuss

it may not be 100% optimal but I would argue that most async (async/await or, worse, "reactive") code that is currently being deployed is broken in edge cases and generally non-trivial to develop and debug

and whenever loom is available for the JVM your normal threaded code suddenly will run just like when it was async/await code, with none of the terrible developer experience

Sagacity fucked around with this message at 13:52 on Oct 18, 2021

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.



if your front end action should block then it should be async on the front end to wait for the appropriate event and your backend doesn't need to be async because the front end has to wait anyway, if your frontend action doesn't block then applying async on the backend doesn't achieve anything anyway because you don't care when the task returns

if you've then somehow run out of cores/threads then you probably need a task queuing system instead

Adbot
ADBOT LOVES YOU

distortion park
Apr 25, 2011


You gotta do it in node because there's only one usable thread

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