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
uG
Apr 23, 2003

by Ralp

Socracheese posted:

yeah but in most cases its doing something trivial like pulling a username or saving a single 'object' so who even cares if it runs in 2ms instead of 3ms

why bother to sperg about it unless its some process that generates a shitton of queries and/or actually taxes the servers

a good orm will allow you to skip object creation altogether for speed, send raw queries, and hell even create your model from your DB structure. writing a bunch of raw sql is job security but who the gently caress wants that job in the first place?

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

w/ checked exceptions, the compiler informs you about the possible errors and asks you to handle them

lol you mean your ide autocompletes an empty catch block with a comment

quote:

w/ option types, the compiler informs you that you should read the code or ask the developer about what is going on because it has no idea

nah you can return them, or you know, write an if statement saying "if this is ok, do some stuff". then you can use exceptions for things that are, you know, exceptions and can't really be recovered from, kill the process and restart.

PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off

tef posted:

- error handling (both of the recoverable and unrecoverable types)

I agree with most of your post but this bit really annoys me. whether or not an error is 'recoverable' is a system-level property, not one that's visible at the point the error is encountered. for a file-handling library, a missing or corrupt file is a unrecoverable error. for an application using that same library to read a config file, a missing file just means you log an error message & load some defaults. a huge part of the premise of exceptions is that you can delegate responsibility for determining the response to an error upwards. this is the fundamental flaw of c-style thinking.

maybe. I don't know. I got real mad about code when I was writing that but I'm not sure I'm actually disagreeing with anyone.

anyway. it's sort of unfortunate that the same syntax is used for a number of very disjoint purposes (nonlocal goto to escape nested loops & python's StopIteration being the most common egregious offenders), but I'm not sure how you'd specialize exceptions to discourage that kind of thing. c++ pulls it off by making try/catch blocks too expensive to use except in times of dire need, but, um...

(it's possible a language I'm unfamiliar with has already solved this problem; I'm really not familiar with as many languages as I'd like to be. need to find a pet project to learn haskell or erlang or somesuch with.)

tef
May 30, 2004

-> some l-system crap ->
use option types for things that can be handled, and let programmer decide wether to delegate it upwards

use exceptions for things that can't and get rid of the catch statement. :v:

keep processes/isolated threads, and when they die you can see why, and chose to restart it.

Shaggar
Apr 26, 2006

tef posted:

lol you mean your ide autocompletes an empty catch block with a comment

yeah if you're a bad programmer

quote:

nah you can return them, or you know, write an if statement saying "if this is ok, do some stuff". then you can use exceptions for things that are, you know, exceptions and can't really be recovered from, kill the process and restart.
yes, you can go ask the developer what each return value means cause he probably didn't document it anywhere, they you can decide which ones you think are "errors" even though that's the job of whoever wrote the method. hopefully the dev remembered it all or you just read thru all the code yourself to figure out where the possible errors are. good luck

also, runtime exceptions are always code problems so restarts will never help.

tef
May 30, 2004

-> some l-system crap ->
with option types you can get rid of null, too :swoon:

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

yes, you can go ask the developer what each exception means cause he probably didn't document it anywhere, they you can decide which ones you think are "errors" even though that's the job of whoever calls the method. hopefully the dev remembered it all or you just read thru all the code yourself to figure out where the possible errors are. good luck

Shaggar
Apr 26, 2006
only an academic could think option types are a good way to handle errors.

PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off
hm. exceptions for non-local exits : proper use of functions & return statements :: exceptions for error-handling : use of many small processes ala classic unix?

mm.

tef posted:

use option types for things that can be handled, and let programmer decide wether to delegate it upwards

use exceptions for things that can't and get rid of the catch statement. :v:

keep processes/isolated threads, and when they die you can see why, and chose to restart it.

haha, saw this when I hit preview

interesting. I'll have to think about it.

Shaggar
Apr 26, 2006

if it throws an exception that's what you've got to deal with. if it throws the wrong exceptions theres nothing you can do. obviously you're being obtuse cause any idiot could understand the difference between being made aware of an error mistakenly (incorrect use of exceptions) vs not being made aware of anything (option types) and hoping for the best.

checked exceptions provide a mechanism for error handling, option types do not.

tef
May 30, 2004

-> some l-system crap ->
they don't really force anything as evidenced by 90% of java programs in production

Shaggar
Apr 26, 2006
you can do option types in java, just have every method return a string and parse it out to see if its an error or good data.

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

you can do option types in java, just have every method return a string and parse it out to see if its an error or good data.

tbc would be proud of you, shaggar.

Shaggar
Apr 26, 2006

tef posted:

they don't really force anything as evidenced by 90% of java programs in production

some programmers are bad so we should give up and not have good tools. let me tell you about my python library....

tef
May 30, 2004

-> some l-system crap ->
dawwww :3:

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Shaggar posted:

also, runtime exceptions are always code problems so restarts will never help.

false, let me tell you about this little guy called SQLException (connection was closed) and how a simple process restart will make it work again

Shaggar
Apr 26, 2006
that's deffo a code flaw. probably an improper connection closing issue likely to do w/ a connection pool.

Shaggar
Apr 26, 2006
if ur handling the connections urself its also a design flaw. if ur not handling the connections urself, theres a bug in whatever library is doing it.

tef
May 30, 2004

-> some l-system crap ->
and yet restarting makes lovely software more robust oh no

i mean, let's just have production die every time while you crappy code janitors argue over which design pattern fixes the bug

Shaggar
Apr 26, 2006
also I hate loud intern cause hes loud and he doesn't know anything about development despite having graduated w/ a cs degree. luckily hes been pigeon holed into somewhere he cant do any damage, for the moment.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

tef posted:

lol you mean your ide autocompletes an empty catch block with a comment

Shaggar posted:

yeah if you're a bad programmer
shaggar was right

good programmers don't need ides

Shaggar
Apr 26, 2006

tef posted:

and yet restarting makes lovely software more robust oh no

i mean, let's just have production die every time while you crappy code janitors argue over which design pattern fixes the bug

if something is failing regularly because of code flaws and you don't want to fix it then it must not matter.

Shaggar
Apr 26, 2006

Cocoa Crispies posted:

shaggar was right

good programmers don't need ides

lol

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Cocoa Crispies posted:

shaggar was right

good programmers don't need ides

without an ide the only way to find out what public methods your OS uses is to compile your code and run it and see if you got it right. much easier to just guess with autocomplete until you figure it out

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

if something is failing regularly because of code flaws and you don't want to fix it then it must not matter.


thanks how!!

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Cocoa Crispies posted:

shaggar was right

good programmers don't need ides

i reckon there're three or four good psych/sociology papers that could be found in programmer machismo

Shaggar
Apr 26, 2006
text editor usage coincides w/ p-lang and Linux usage and is a clear sign of mental health issues

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Shaggar posted:

text editor usage coincides w/ p-lang and Linux usage and is a clear sign of mental health issues

yes, excellent mental health

and j-languages are a clear sign of mental disability

Shaggar
Apr 26, 2006
"just restart the server when it fails" -tiny tef child.

tef
May 30, 2004

-> some l-system crap ->
gets 99.9999999% uptime

tef
May 30, 2004

-> some l-system crap ->
every time windows crashes, shaggar sits with his computer off until he knows microsoft have shipped a patch, before trying to use it again.

Shaggar
Apr 26, 2006
windows doesn't crash unless its a hardware problem, but im sure restarts will fix a hardware problem.

also its great when the thing that's supposed to handle the restart on failure fails so everything sits in a hung state. just restart it every 5 minutes cause no ones actually using it anyways

tef
May 30, 2004

-> some l-system crap ->
that's because a j-lang programmer wrote it and it's pausing to collect garbage

Shaggar
Apr 26, 2006
whoops, no one told me about that option type error value so my gigantic if block didn't handle it! I guess the service hasn't worked for days but no one noticed... 100% uptime :smug:

Nomnom Cookie
Aug 30, 2009



tef posted:

and yet restarting makes lovely software more robust oh no

i mean, let's just have production die every time while you crappy code janitors argue over which design pattern fixes the bug

runit will restart up to once a second until your code figures out how to not crash. its rly cool and installing runit is the first thing i do on redhate systems now

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

whoops, no one told me about that option type error value so my gigantic if block didn't handle it! I guess the service hasn't worked for days but no one noticed... 100% uptime :smug:

option types alone dont help much but look at scala for example. it's a really clean way of describing uncertainty without endless ifnulls and you then reserve exceptions for situations where you really want to crash the process. java 8's sugar over inner classes will probably help a lot wrt writing similar code in java

Shaggar
Apr 26, 2006
why not just use checked exceptions to help avoid the possibility of missed problems. the point is that with checked exceptions you can guarantee that the errors the method writer knows can happen will be handled. with an option type, even if the user has the intention to handle everything, they can make a mistake that the compiler wont catch. theres no benefit to doing it that way and a ton of downside.

tef
May 30, 2004

-> some l-system crap ->
lol

Shaggar
Apr 26, 2006
I mean seriously. whats the upside? you maybe kind of save some typing if you choose to ignore the problem?

Adbot
ADBOT LOVES YOU

Nomnom Cookie
Aug 30, 2009



would i get probated for c/ping this primo shaggarposting to CoC

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