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.
 
  • Locked thread
Shaggar
Apr 26, 2006
spring is a di container so the idea is to abstract the implementation from the consumer this way if you add or remove or change implementations its a runtime concern instead of compile time.

in the case of cxf and a soap service, you could have a local copy of the library that performs those same tasks, or with one line in your spring config you could replace the local implementation bean with a cxf proxy bean. the code that gets the injected bean (whether local implementation or remote proxy) doesn't care.

i would say that yes spring is probably over used in many cases, but it has its uses. a more complex example is i have a set of web services that each use one of 6 predefined interfaces. i stuff the list of endpoints and which interface they use into the database and on boot the consumer gets that list and generates CXF proxies for each one using the interface and endpoint address. The code that looks up services for use doesn't care how they got there, it just asks for one that suits its needs and the container obliges. Doing this in spring saves some headache. I could totally write my own singleton collection of services and load it on boot the same way, but im already using spring and cxf so why not take advantage of whats there?

theres also voodoo magic like spring-mybatis which is just too good.

Adbot
ADBOT LOVES YOU

Soricidus
Oct 21, 2010
freedom-hating statist shill

Bloody posted:

the performance is obviously going to be linear in both cases idk how that isn't clear

the loop version simply performs a single pass over the input. the filter/foreach version allocates a new array, performs a first pass over the input adding elements to the new array, and then performs a second pass over the new array. except when it doesn't because maybe a smart runtime covered for the inefficiency.

i'm not claiming that's a big deal, i'm just saying that i don't see the purpose of using something that might be less efficient when it doesn't have any obvious advantages to make up for the uncertainty?

gonadic io
Feb 16, 2011

>>=
using the functional approach gives you better separation of concerns should you need to extend it

sure with this tiny example they're both really simple but I'd way rather see 8 methods chained than a forloop with 8 things happening in the body.

and if you separate out the concerns using different forloop-ed functions you no longer get the single pass that the lazy collection gives you.

gonadic io
Feb 16, 2011

>>=
doing side-effecting code lazily is some poo poo though and can cause fun stuff like exceptions escaping a try/catch because the declaration of the lazy collection doesn't trigger them, only whatever code later down the line that actually evaluates the collection

Soricidus
Oct 21, 2010
freedom-hating statist shill

gonadic io posted:

using the functional approach gives you better separation of concerns should you need to extend it

sure with this tiny example they're both really simple but I'd way rather see 8 methods chained than a forloop with 8 things happening in the body.

and if you separate out the concerns using different forloop-ed functions you no longer get the single pass that the lazy collection gives you.

thanks for spelling it out, that makes sense

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

Soricidus posted:

the loop version simply performs a single pass over the input. the filter/foreach version allocates a new array, performs a first pass over the input adding elements to the new array, and then performs a second pass over the new array. except when it doesn't because maybe a smart runtime covered for the inefficiency.

i'm not claiming that's a big deal, i'm just saying that i don't see the purpose of using something that might be less efficient when it doesn't have any obvious advantages to make up for the uncertainty?

the "functional" version is better because it communicates intent. a for loop can do a lot of things, a filter only does one thing. you have to read the whole for loop in order to know that it's only doing a filter. in this case its pretty basic but as it gets more complicated the functional approach lets you know whats going on before you even read the lambdas/functions. like if you see a = b.filter(...).map(...) you know the general structure of whats going to happen before you even read the ....

VikingofRock
Aug 24, 2008




gonadic io posted:

yeah but

JavaScript code:
butts.filter(butt => butt.isBig())
     .forEach(butt => butt.insertProbe())
is better than either of those

and

code:
map insertProbe . filter isBig $ butts
is better yet!

Bloody
Mar 3, 2013

verilog is the worst loving language and it loving infuriates me that this loving garbage still exists
nevermind that the loving toolchains are nightmare piles of proprietary rear end at every single step of the loving equation, the fundamental languages that feed into them are loving trash
you thought uptake on new poo poo in c++ was bad? verilog was deprecated loving sixteen years ago by systemverilog and this loving toolchain doesnt support any of the new bits

you wanna have a two-dimensional register? ok thats fine
wait you wanna make it an input? gently caress you, flatten it to one dimension then rearrange it on the other side of the boundary

a loving high school cs student could write a better loving language than this

loving verilog
verilog makes me drink

Bloody
Mar 3, 2013

im installing haskell and clash and spending the rest of time figuring out whatever the gently caress that pile of mess is because it will be less of a waste of time than working with verilog

weird
Jun 4, 2012

by zen death robot

leper khan posted:

big_butts = [butt for butt in butts where butt.is_big()]

e:
lazy_butts = (butt for butt in butts where butt.is_big())

:catyikes:

Bloody
Mar 3, 2013

oh right im at work and every loving pile of poo poo piece of software that connects to the internet inexplicably cannot figure out how to use loving system proxy settings and half the time ships with no way of working with a loving proxy in the first place so of course its immediately rendered useless

gently caress this poo poo im out

Bad Sneakers
Sep 4, 2004

me irl
i learned about binary trees today :shobon:

Bloody
Mar 3, 2013

:toot:

gonadic io
Feb 16, 2011

>>=

Bloody posted:

im installing haskell and clash and spending the rest of time figuring out whatever the gently caress that pile of mess is because it will be less of a waste of time than working with verilog

lol what kind of masochistic streak are you on that a c++ embedded programmer (right? i forget my yospos.xlsx) has decided to learn verilog and/or haskell?

p.s. post here if you have any questions, i really miss the beginner haskell (and also python) that i used to teach as a phd student

oh no blimp issue
Feb 23, 2011

Bad Sneakers posted:

i learned about binary trees today :shobon:

what new kind of tree will you learn tomorrow, i like b trees

oh no blimp issue
Feb 23, 2011

they're like binary trees but more

Bloody
Mar 3, 2013

gonadic io posted:

lol what kind of masochistic streak are you on that a c++ embedded programmer (right? i forget my yospos.xlsx) has decided to learn verilog and/or haskell?

p.s. post here if you have any questions, i really miss the beginner haskell (and also python) that i used to teach as a phd student

your yospos.xlsx is close but ive been doing 50/50 verilog bullshit/glorious c# for a year or so now

getting really fuckin sick of the verilog bullshit tho

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

Awia posted:

they're like binary trees but more

fat. b trees are like binary trees, but really loving fat. the ones used for databases, anyhow

i like them too

oh no blimp issue
Feb 23, 2011

YeOldeButchere posted:

fat. b trees are like binary trees, but really loving fat. the ones used for databases, anyhow

i like them too

how fat we talking?

jesus WEP
Oct 17, 2004


idk poo poo about data structures, lol

oh no blimp issue
Feb 23, 2011

you probably dont need to know
just put everything in a list/vector/array

AWWNAW
Dec 30, 2008

for some reason it really blew my mind how binary trees can be represented as arrays. I'm also an idiot

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Awia posted:

how fat we talking?

5 branches per node IIRC?

e: most commonly 3 it seems

hackbunny fucked around with this message at 23:54 on Mar 10, 2016

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

Awia posted:

how fat we talking?

real fat. like hundreds of values and children for a single node, instead of the anorexic one value per node in a binary tree

oh no blimp issue
Feb 23, 2011

hackbunny posted:

5 branches per node IIRC?


YeOldeButchere posted:

real fat. like hundreds of values and children for a single node, instead of the anorexic one value per node in a binary tree

who do i believe?

jesus WEP
Oct 17, 2004


like i learned enough to pass my data structure & algorithm class, and the forgot it all straight away

oh no blimp issue
Feb 23, 2011

St Evan Echoes posted:

like i learned enough to pass my data structure & algorithm class, and the forgot it all straight away

the primary function of data structures is to annoy undergrads

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Awia posted:

what new kind of tree will you learn tomorrow, i like b trees

u will love mumps, the only data type other than string is btrees

oh no blimp issue
Feb 23, 2011

"lists? queues? stacks? naw m8 all we need is a btree"

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

Awia posted:

who do i believe?

me

actually the branch factor for b trees is whatever you want it to be. when you look at the big o it seems like it doesn't matter because operations are still gonna be o(logn) and all that changes is the base of the logarithm and that isn't supposed to matter. but if your b tree is on something like a hard drive (as for a db index) where random seeks are expensive and linear reads are cheap, making the b tree really fat and short means you do fewer seeks to get to a leaf, so that ends up being a lot faster and improves your throughput compared to a tall skinny binary tree that does a bunch more seeks all over the place like a loving idiot

Valeyard
Mar 30, 2012


Grimey Drawer

Awia posted:

"lists? queues? stacks? naw m8 all we need is a btree"

just heap sort everything

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
does anyone know a good intro to paring heaps?

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

yeah I never used b-trees irl, just studied them in a databases course

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Valeyard posted:

just heap sort everything

lol, in mumps a btree node's children are sorted in ascii collation order by key so there are no sorting algorithms for mumps, you just make the key whatever you want to sort by. you implement stacks, queues, etc as one-level btrees. its like some gilligans island make everything out of coconuts type poo poo.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
if you had to pick one data structure to use for literally everything btrees are a pretty good choice

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme

St Evan Echoes posted:

like i learned enough to pass my data structure & algorithm class, and the forgot it all straight away

Same and now I've got to learn it all again for an interview in 5 weeks. I'm a dirty embedded bit-diddler and rarely think about data structures and never deal with algorithms.

Bloody: PS at least it ain't VHDL

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Plorkyeran posted:

if you had to pick one data structure to use for literally everything btrees are a pretty good choice

key word is had to, which was definitely the case with mumps since it was originally created to run on one specific mainframe, but the drawback is that your floor performance for all operations is also O(log n) which blows for things where you could get a constant time lookup with something like a hash table. whenever we need to do some type of duplicate checking, for example, there's clearly some performance we're losing there since even if we store hashes of objects we can still only see if that hash is in the tree in o(log n) time.

one cheat we do now is to send that sort of work to the web server that runs our c# frontend since we can use other data structures there. we've done testing and in a typical production deployment the latency from sending the data to another server is usually less than the time saved by crunching a big set of hashes or whatever.

Bloody
Mar 3, 2013

meatpotato posted:

Same and now I've got to learn it all again for an interview in 5 weeks. I'm a dirty embedded bit-diddler and rarely think about data structures and never deal with algorithms.

Bloody: PS at least it ain't VHDL

i am aggressively violating company guidelines by not using vhdl lmao

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

LeftistMuslimObama posted:

one cheat we do now is to send that sort of work to the web server that runs our c# frontend since we can use other data structures there. we've done testing and in a typical production deployment the latency from sending the data to another server is usually less than the time saved by crunching a big set of hashes or whatever.

yeah this seems sane to me

everything you post about mumps and healthcare it in general is amazing :allears:

Adbot
ADBOT LOVES YOU

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

YeOldeButchere posted:

yeah this seems sane to me

everything you post about mumps and healthcare it in general is amazing :allears:

i really, truly wish i could share more without violating patents and copyrights and such. the rabbit hole is so much deeper than you know. we dominate the marketplace by being the least bad. it's like how ms word is the best word processor. like, it's rough and there's a lot of pain points but wtf else are you going to use, libre office?

  • Locked thread