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
Arcsech
Aug 5, 2008

Subjunctive posted:

I fly too much to want to ask follow-up questions. :ohdear:

planes are strictly regulated enough that they're pretty much fine

its poo poo like the power grid (not reactors, distribution), other utilities, and misc government systems that are ultrafucked

edit: basically stuff that won't directly kill people but would cause chaos or ruin lives if it malfunctioned/got hacked

Arcsech fucked around with this message at 02:46 on Apr 24, 2014

Adbot
ADBOT LOVES YOU

nrook
Jun 25, 2009

Just let yourself become a worthless person!
there's a weird vibe going on that you write unit tests so that your code doesn't explode the golden gate bridge and kill hundreds

you write unit tests because it's faster in the medium term than not writing them. "management" doesn't care about best practices, but what they do care about is three years down the line, Fuckface unit has happy customers and more rapid development, and Bitchass team can't find their rear end with both their hands, and guess why?

unit tests

this is especially true in dynamically typed languages, I have no clue how you'd write python without tests. unless you love seeing TypeError in your production logs I guess?

note: I dunno if this applies to scrappy startups with two developers and it probably doesn't apply to games unless you're blizzard. but if you care at all about v2 you gotta write tests bro

nrook fucked around with this message at 03:55 on Apr 24, 2014

Nomnom Cookie
Aug 30, 2009



so how does one differentiate between good tests and bad tests?

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

Kevin Mitnick P.E. posted:

so how does one differentiate between good tests and bad tests?

i'll save you several steps



https://github.com/mattdiamond/fuckitjs

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
if you're writing poo poo in js you probably aren't even concerned about good code or bad code so i'm not sure why you'd care about good or bad tests

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
i'm writing a thing in node precisely because i don't give a gently caress about it, i just want it fast and cheap

Spime Wrangler
Feb 23, 2003

Because we can.

Arcsech posted:

planes are strictly regulated enough that they're pretty much fine

its poo poo like the power grid (not reactors, distribution), other utilities, and misc government systems that are ultrafucked

edit: basically stuff that won't directly kill people but would cause chaos or ruin lives if it malfunctioned/got hacked

"i had the it guys set it up so i can monitor and control all our generators from my laptop from wherever, just as easy as if i was on site"

- chief engineer of a multi gw coal plant, to me

who knows what kind of security that entailed but im guessing lol at some level. see also: that virus-weapon we used on iran's nuclear program a while back. hoppin airgaps on usb and covering its tracks while it blows poo poo up with multiple zero-days


nrook: unit tests are a different from big-E Engineering risk assessment and mitigation processes like FMEA

they play a role but the key element is the process of stepping back from design, enumerating all the ways each part of the system can fail (hardware, software, user, etc), enumerating all the immediate and eventual effects of those failures, and systematically designing them out of the system where possible. from an FMEA perspective, unit and integration tests are a tool to make sure that specific failure modes have been eliminated or mitigated. the FMEA process is there to help make sure you're testing for the right things in the right way and prioritizing them properly.

nrook
Jun 25, 2009

Just let yourself become a worthless person!

Spime Wrangler posted:

nrook: unit tests are a different from big-E Engineering risk assessment and mitigation processes like FMEA

they play a role but the key element is the process of stepping back from design, enumerating all the ways each part of the system can fail (hardware, software, user, etc), enumerating all the immediate and eventual effects of those failures, and systematically designing them out of the system where possible. from an FMEA perspective, unit and integration tests are a tool to make sure that specific failure modes have been eliminated or mitigated. the FMEA process is there to help make sure you're testing for the right things in the right way and prioritizing them properly.

yeah, that's what I wanted to make explicit, though it sounds like I failed

unit tests (and integration tests too) are just something you do when writing good code. "engineering" is something different and more expansive

JewKiller 3000
Nov 28, 2006

by Lowtax

nrook posted:

this is especially true in dynamically typed languages, I have no clue how you'd write python without tests. unless you love seeing TypeError in your production logs I guess?

you know, there are programming languages where type errors are not something you EVER have to test for, and not all of these languages look like java. why do people insist on using lovely languages that force them to write tons of tests before they can get any real work done?

Juul-Whip
Mar 10, 2008

i am sorry if this has come up about 500 times already but does anyone want to explain the benefits of duck typing to me

right now I've got "it's maybe easier for dumbs" and that's about it. this shitfuck declared a bunch of fields at the top of a file, what are they? I don't know because they're all "var"

e: lol Duck typing has been demonstrated to increase programmer productivity in a controlled experiment.[18][not in citation given]

Juul-Whip fucked around with this message at 06:41 on Apr 24, 2014

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

JewKiller 3000 posted:

you know, there are programming languages where type errors are not something you EVER have to test for, and not all of these languages look like java. why do people insist on using lovely languages that force them to write tons of tests before they can get any real work done?

agreed, a thousand times



(when you talk about a language where you don't have to check for type errors i assume you mean PHP)

Deus Rex
Mar 5, 2005

Bloody posted:

dont forget those patriot missile floating point error bit where the clocks drifted a shitload really quickly and then a bunch of israelis died or w/e

yeah not seeing the problem here :twisted:

Fuck them
Jan 21, 2011

and their bullshit
:yotj:
https://www.youtube.com/watch?v=3Bby5pOVZJ0

Cybernetic Vermin
Apr 18, 2005

THC posted:

i am sorry if this has come up about 500 times already but does anyone want to explain the benefits of duck typing to me

right now I've got "it's maybe easier for dumbs" and that's about it. this shitfuck declared a bunch of fields at the top of a file, what are they? I don't know because they're all "var"

e: lol Duck typing has been demonstrated to increase programmer productivity in a controlled experiment.[18][not in citation given]

brevity is an often overlooked argument since it is easy to feel it is just code for being lazy, but there is also a bit of a tendency that the complexity of the unit of code you can effectively work with (and as a consequence the maximum size of a unit of abstraction) is bounded by the amount you can reasonably efficiently see at one time. brevity without duck typing is possible, but type inference is not exactly fully solved in general, and complex polymorphism will often be rather tricky (or at least verbose) to work with

hardly a convincing argument in itself, but if anything supports the efficiency increase claims i do think the amount of information you can fit in a certain amount of space is a big part of it

Breakfast All Day
Oct 21, 2004


java_to_english.flv

zokie
Feb 13, 2006

Out of many, Sweden

just pretend I made a Wittgenstein joke thingy like this: Whereof one can post, one can poo poo post. Whereof one cannot post thereof one must lurk.

Juul-Whip
Mar 10, 2008

Cybernetic Vermin posted:

brevity is an often overlooked argument since it is easy to feel it is just code for being lazy, but there is also a bit of a tendency that the complexity of the unit of code you can effectively work with (and as a consequence the maximum size of a unit of abstraction) is bounded by the amount you can reasonably efficiently see at one time. brevity without duck typing is possible, but type inference is not exactly fully solved in general, and complex polymorphism will often be rather tricky (or at least verbose) to work with

hardly a convincing argument in itself, but if anything supports the efficiency increase claims i do think the amount of information you can fit in a certain amount of space is a big part of it

I used to think I liked this as well but it becomes a nightmare with larger projects (e.g. anything with more than like 2 ppl) and I just cant

Juul-Whip fucked around with this message at 08:12 on Apr 24, 2014

Cybernetic Vermin
Apr 18, 2005

it is perfectly possible to write huge and complex projects in weakly typed languages, but it requires discipline when it comes to abstraction

to a great extent though the reason why java works out well is because its structure lets a few simple syntactic rules (public = bad, big class = bad, etc) enforces a lot of tiny abstraction units. this still means that if written with little thought the logical abstractions will not be well represented by any given class, but it will likely naturally get approximated, like how if you slice a world map into sufficiently many tiny pieces there will for each country exist a subset of pieces approximating its border

trying to force abstraction by rigid and decidable syntactical rules is not too bad, it isolates and localizes the breakage any one given idiot can introduce into a project, but it is hardly *impossible* to find ways of encouraging good abstraction in other ways

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

THC posted:

i am sorry if this has come up about 500 times already but does anyone want to explain the benefits of duck typing to me

right now I've got "it's maybe easier for dumbs" and that's about it. this shitfuck declared a bunch of fields at the top of a file, what are they? I don't know because they're all "var"

e: lol Duck typing has been demonstrated to increase programmer productivity in a controlled experiment.[18][not in citation given]

are you really talking about duck typing or is it really dynamic typing


btw I can't wait to read another page of people equating dynamic typing to stuff like javascript's coercion rules.

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

Cybernetic Vermin posted:

brevity is an often overlooked argument since it is easy to feel it is just code for being lazy, but there is also a bit of a tendency that the complexity of the unit of code you can effectively work with (and as a consequence the maximum size of a unit of abstraction) is bounded by the amount you can reasonably efficiently see at one time. brevity without duck typing is possible, but type inference is not exactly fully solved in general, and complex polymorphism will often be rather tricky (or at least verbose) to work with

whenever ive written a Java/C# function that spanned more than one screen, ive strongly suspected that its because i hosed up structuring my code.

hell even ~20 lines is enough to make my spidey senses tingle

similarly if ive written something and reading it back i need to frequently check the definitions of the constituent functions to work out what it does, then i've probably hosed up my function naming or ive written a constituent function with one name that does two things.

e: not to say long functions are always bad for comprehension. but they usually are.

coffeetable fucked around with this message at 09:00 on Apr 24, 2014

Soricidus
Oct 21, 2010
freedom-hating statist shill
duck typing is a nice idea in theory

like in java it's ridiculous that there are methods in the standard library that require a StringBuffer and i can't pass them a StringBuilder instead

but it's not clear that it makes up for losing static type checks

i kinda like how ocaml mixes the two, but nobody uses objects in ocaml so i guess it probably isn't that great in practice?

Breakfast All Day
Oct 21, 2004

anything other than strong typing is like wearing pajamas all day or getting blackout drunk every night or posting

its fun to try for awhile in college but is just embarrassing and unproductive later

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
my limited experience with java is that some people really want to do some duck typing and then end up with some convoluted concoction to achieve the same idea

this is most probably bad java but the point is that you should surrender yourself and embrace the duck

Cybernetic Vermin
Apr 18, 2005

coffeetable posted:

whenever ive written a Java/C# function that spanned more than one screen, ive strongly suspected that its because i hosed up structuring my code.

hell even ~20 lines is enough to make my spidey senses tingle

similarly if ive written something and reading it back i need to frequently check the definitions of the constituent functions to work out what it does, then i've probably hosed up my function naming or ive written a constituent function with one name that does two things.

e: not to say long functions are always bad for comprehension. but they usually are.

a single function should very seldom need to be very large, but very often a slightly more complex set of functionality will require a decent chunk of code which, while divided into support functions and such, only has internal abstractions to the degree necessary for comprehension. that is, the functions will not be all that general, and will as building blocks for this piece of functionality likely change as needed as things are worked out, and will often have a signature that is slightly more involved (e.g. involve some awareness of some complex internal structures) than you would in a properly abstracted external api

in these situations there is, i claim at least (i suspect this is all rather controversial), a very significant fall-off point in efficiency of thought as the code becomes less and less convenient to view as a whole (first when it falls out of your center of vision, then when it no longer fits on screen in a linear way, then when various split views and such no longer fit it, followed eventually by matters of spatial memory)

Zombywuf
Mar 29, 2008

Cybernetic Vermin posted:

in these situations there is, i claim at least (i suspect this is all rather controversial), a very significant fall-off point in efficiency of thought as the code becomes less and less convenient to view as a whole (first when it falls out of your center of vision, then when it no longer fits on screen in a linear way, then when various split views and such no longer fit it, followed eventually by matters of spatial memory)

This comes down to whether or not the parts have been split into units or simply wrapped in needless abstraction (if you're looking at Java it's definitely the latter) and whether the parts have been named well. Functions should be short and do a thing you can explain in at most 3 words.

Sapozhnik
Jan 2, 2005

Nap Ghost

Soricidus posted:

duck typing is a nice idea in theory

like in java it's ridiculous that there are methods in the standard library that require a StringBuffer and i can't pass them a StringBuilder instead

but it's not clear that it makes up for losing static type checks

i kinda like how ocaml mixes the two, but nobody uses objects in ocaml so i guess it probably isn't that great in practice?

Here's a hint, if the JavaDoc for a given class says "Since JDK 1.0" and it isn't java.lang.String or something then it's probably a terribly designed class. The JDK didn't exactly get off to the best start.

Which is basically the stupidest poo poo ever, since... well, think about it for more than five seconds. So we have StringBuilder which doesn't have locks, but that came along later.

The fact that Java Strings are immutable and mutable buffers are a separate utility is really nice though, and imho mutability is the biggest reason why C++'s std::string sucks poo poo (there are many, many others. but don't write your own version of the STL, for god's sake, it's standardised therefore it must be well-designed!! :byodood: )

Sapozhnik
Jan 2, 2005

Nap Ghost
Java: a terrible programming language for being an insecure dunning-kruger who loves to show off as much as possible

and an excellent programming language for actually getting poo poo done

Cybernetic Vermin
Apr 18, 2005

no, java is an excellent programming language for its purpose, but the fact remains that one of its best properties is that it insulates your business a bit when hiring really terrible programmers, as you invariably will since the incredibly dull lob apps don't exactly retain actual talent

i mean, this sounds trollishly elitist, but it should be thoroughly obvious that a lot of what the market selects for is insulation from incompetence, as there are a lot of mediocre programmers with a few bad college courses and perhaps a certifications. the average construction worker does not carve exquisite wooden ornaments at home, and no one expects them to, as long as they can pour concrete and hammer in a nail as needed

programming is not a high-skill job, and that is a good thing, because there is a lot of it to do, and a lot of people who are willing to do it despite not being deeply invested or interested. it is a weird quirk of history and community that makes this at all controversial

emoji
Jun 4, 2004
i'm doing java python interop over jni because all the good database drivers are jdbc and all the good interactive numerical packages are in scipy

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
"static typing restrains bad programmers, therefore dynamic typing is better for good programmers btw im a good programmer"

emoji
Jun 4, 2004
i have heard that different types of programming languages are good for different things and not all programming is application development

MononcQc
May 29, 2007

kraftwerk singles posted:

i have heard that different types of programming languages are good for different things and not all programming is application development

get out of here!!!

MononcQc
May 29, 2007

Also mandatory post on optional type checking I make every time this debate comes on.

Cybernetic Vermin
Apr 18, 2005

i have quit programming outside of occasional fun projects, in professional programming i went for overly elaborate solutions that weren't really suited for their purpose and was inefficient with my time. mediocre lob 9-5 java programmers, who are aided by the restraints of java style and practice *are* real programmers and are doing an important job. you obviously have high ideas of what programming is and are trying to apply them to what i am saying, but the facts are quite the opposite

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
sorry but type checking is useless. it is just an opportunity to have the computer throw more errors at you, and they aren't even real errors. the first step in determining whether you are using a bad programming language is to try to add 2 and 2.1. if the computer thinks it can't do it then you have a bad programming langauge.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Soricidus posted:

like in java it's ridiculous that there are methods in the standard library that require a StringBuffer and i can't pass them a StringBuilder instead

that's probably something that could have been solved in Java with use of an interface, without having to change the type system.

Zombywuf
Mar 29, 2008

My experience tells me that those mediocre Java programmers are just piling abstraction into your code to make it impossible to maintain. It's like praising someone for being a good gardener because they keep piling soil into your garden. I mean, gardens need soil right?

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Tiny Bug Child posted:

sorry but type checking is useless. it is just an opportunity to have the computer throw more errors at you, and they aren't even real errors. the first step in determining whether you are using a bad programming language is to try to add 2 and 2.1. if the computer thinks it can't do it then you have a bad programming langauge.

ghci> 2 +2.1
>>> 4.1

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

Tiny Bug Child posted:

sorry but type checking is useless. it is just an opportunity to have the computer throw more errors at you, and they aren't even real errors. the first step in determining whether you are using a bad programming language is to try to add 2 and 2.1. if the computer thinks it can't do it then you have a bad programming langauge.

you know static type systems can have type inference too right

Adbot
ADBOT LOVES YOU

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Malcolm XML posted:

ghci> 2 +2.1
>>> 4.1

cool. being able to add two numbers is a necessary, but not sufficient, condition for being a good programming language. next try the advanced case of adding "2" and 2.

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