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
Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
A problem with visual programming systems that often isn't discussed is their tendency to strip programmers of the broad range of pre-existing tools for manipulating text. Whether it's basics like grep or diff, or the ability to share code by pasting it into IRC, email, markdown documents and pastebins, if the designers of the visual programming system didn't provide some equivalent you're out of luck. See also: Smalltalk. Visual programming systems which can serialize in a reasonable textual format make it possible to overcome some of these issues, but I'm still really unconvinced they're a net gain.

Adbot
ADBOT LOVES YOU

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal
I remember when I was in high school and we had a day where they paired us with someone who worked in something we were potentially interested in as a career, and for various reasons I ended up at a civil engineering company. Even back then I was a bit worried when they showed me one of the tools they used to do structural stuff, which was a big excel spreadsheet where they'd punch in parameters describing the loading on something, the various constants that described the properties of the material they were using, and so on and so forth. A bunch of stuff was calculated based on that, and some cells would be highlighted in red if values were outside their safe range. Then they'd gently caress around the inputs until nothing was red, and I guess that's how bridges are designed.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

canis minor posted:

My brother is a perfect example of this - I love him dearly, but I feel slightly uncomfortable when he shows me an "application" that is used to calculate mortgage interest rates "written" in Excel.


Also this. All in a top international bank.

I mean - all the calculations and formulas are his work, but you'd think there should be some IT department that would take those and spin into some sensible app. Nope - no resources :v:

I can top this. My first job out of college was at a specialty gas manufacturer. All of their calculations for mixtures (of very, very, very corrosive, fatal-if-inhaled, explosive, explosively-unstable-at-room-temperature) gases were done via Excel spreadsheets with VBA.

But it worked. They never had an explosion, at least not due to that spreadsheet. I refused to touch that thing. Today, I would have a field day writing a test suite around their calculations and ensuring the calculations were actually correct. And getting it in source control.

That was a fun place to work.

tyrelhill
Jul 30, 2006
Funny how the world continues to spin with bad practices and lack of unit testing

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

YeOldeButchere posted:

I remember when I was in high school and we had a day where they paired us with someone who worked in something we were potentially interested in as a career, and for various reasons I ended up at a civil engineering company. Even back then I was a bit worried when they showed me one of the tools they used to do structural stuff, which was a big excel spreadsheet where they'd punch in parameters describing the loading on something, the various constants that described the properties of the material they were using, and so on and so forth. A bunch of stuff was calculated based on that, and some cells would be highlighted in red if values were outside their safe range. Then they'd gently caress around the inputs until nothing was red, and I guess that's how bridges are designed.

From what little I know of engineering, they used to have (and probably still do have in many places) gigantic piles of binders containing thousands of pages of meticulously detailed information on the physical properties of different kinds of materials. Designing a bridge that has to be able to handle certain loads in a specific environment could involve many days' worth of looking up and cross-referencing what amounts to humongous tables of data. Excel is...not actually a bad first replacement for that, and I can well believe that it's a massive improvement over what they had before.

I guess what I'm saying is, just because a program is written in Excel doesn't automatically make it a bad program. If your program consists primarily of a bunch of tables of (largely fixed) data and then a few formulae combining them, then Excel makes a decent amount of sense!

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

tyrelhill posted:

Funny how the world continues to spin with bad practices and lack of unit testing

I think it was more luck than anything else. The calculations were always hand-checked and then redone from scratch if there was a discrepancy.

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

TooMuchAbstraction posted:

From what little I know of engineering, they used to have (and probably still do have in many places) gigantic piles of binders containing thousands of pages of meticulously detailed information on the physical properties of different kinds of materials. Designing a bridge that has to be able to handle certain loads in a specific environment could involve many days' worth of looking up and cross-referencing what amounts to humongous tables of data. Excel is...not actually a bad first replacement for that, and I can well believe that it's a massive improvement over what they had before.

I guess what I'm saying is, just because a program is written in Excel doesn't automatically make it a bad program. If your program consists primarily of a bunch of tables of (largely fixed) data and then a few formulae combining them, then Excel makes a decent amount of sense!

I kind of get that, but the thing is you just know that somebody made the spreadsheet once, put it on a network share, and people made local copies of it. Then some people made changes to their local copies, and gave that version to other people when asked, and before you know it there's like 50 different versions of nebulous origin floating around and nobody really knows what's different in each one.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

YeOldeButchere posted:

I kind of get that, but the thing is you just know that somebody made the spreadsheet once, put it on a network share, and people made local copies of it. Then some people made changes to their local copies, and gave that version to other people when asked, and before you know it there's like 50 different versions of nebulous origin floating around and nobody really knows what's different in each one.

That's more of a version control and deployment issue than a code issue though, isn't it? I guess it's just another one of the skillsets that software developers are expected to learn, but others may well not pick up.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

TooMuchAbstraction posted:

That's more of a version control and deployment issue than a code issue though, isn't it? I guess it's just another one of the skillsets that software developers are expected to learn, but others may well not pick up.

Yeah. There's this temptation as computer touchers and programmers to look down on things that might be hacked together with suboptimal tools, but many people's primary jobs require a tiny bit of data crunching and mostly something else completely. These people want the easiest tool that's most readily available. For most normal people in most office environments, that winds up being Excel.

Bongo Bill
Jan 17, 2012

It's not close to production-strength yet, but Stencila is germane to this topic.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Internet Janitor posted:

A problem with visual programming systems that often isn't discussed is their tendency to strip programmers of the broad range of pre-existing tools for manipulating text. Whether it's basics like grep or diff, or the ability to share code by pasting it into IRC, email, markdown documents and pastebins, if the designers of the visual programming system didn't provide some equivalent you're out of luck. See also: Smalltalk. Visual programming systems which can serialize in a reasonable textual format make it possible to overcome some of these issues, but I'm still really unconvinced they're a net gain.

Oh, I definitely agree. I don't entirely visual solutions are the answer, but I think having more visualization and code editing tools would be interesting. NoFlo is definitely not all the way there, but it's a step in the right direction.

Amberskin
Dec 22, 2013

We come in peace! Legit!

canis minor posted:


Also this. All in a top international bank.

I mean - all the calculations and formulas are his work, but you'd think there should be some IT department that would take those and spin into some sensible app. Nope - no resources :v:

Heh, are you and me coworkers perhaps?

I've seen things you would not believe. For instance, developers willingly disabling the compiler's overflow detection just because catching it as an exception is hard. Or something like that.

Overflow detection disabled => truncation.

In a bank.

Regarding to money amounts

:psyboom:

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Amberskin posted:

Heh, are you and me coworkers perhaps?

I've seen things you would not believe. For instance, developers willingly disabling the compiler's overflow detection just because catching it as an exception is hard. Or something like that.

Overflow detection disabled => truncation.

In a bank.

Regarding to money amounts

:psyboom:

I'd ask you to name and shame, but I suspect the answer is "literally all of them." Not that it matters because the value of my account (or basically anyone else's) won't get there anyway.

qntm
Jun 17, 2009
My water supplier computes "two thirds" as 0.667 and "one third" as 0.333. They're stealing pennies per year from me with that scam.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



tyrelhill posted:

Funny how the world continues to spin with bad practices and lack of unit testing

It does until it doesn't. Google 'excel error cancer treatment' for a decent example of "doesn't"

Amberskin
Dec 22, 2013

We come in peace! Legit!

qntm posted:

My water supplier computes "two thirds" as 0.667 and "one third" as 0.333. They're stealing pennies per year from me with that scam.

Hehehe... I'll go into old fart mode now.

The year is 1999. The place is, somewhere in the Euro zone.

The rules of the conversion between national currencies and Euro establish that you have to apply 5/4 rounding, except if the result is going to be zero (in that case you had to round up). For instance, let's take Spain. An Euro (EUR) is worth 166.386 old spanish pesetas (ESP). So 1 ESP = 0,0060 EUR, that is, 0,60 euro cents. For the rounding rule, 1 ESP = 0,01 EUR then.

By the same rule, 0,01 EUR = 1,6638 ESP. The ESP had no fractional units, so applying the rounding rule 0,01 EUR = 2 ESP.

A smart guy decided he had found his own private money making machine. So him opened an account in euros and an account in ESP in a bank, and put together a script to drive that bank internet home banking service to transfer 1 ESP to the account in Euros, and transfer 0,01EUR back to the account in ESP. Yay, free money!

The bank detected the pattern when the guy had accumulated something like 100 EUR. Of course, you could not stop it from happening legally. So the solution was simply to apply an 1 EUR fare for each 100 transactions, so the "profits" got eaten.

The guy also got a visit by some nasty lawyers. And, legend says, he was hired by one of the contractors which develop the home banking systems. But I can't confirm that.

Those were the times...

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Munkeymon posted:

It does until it doesn't. Google 'excel error cancer treatment' for a decent example of "doesn't"

Different people get different results from the same Google search, and the article I think you were probably alluding to doesn't show up as the first result for me (it is fourth in the list). Here is the article I think you wanted to refer to:

http://biomedicalcomputationreview.org/content/error-%E2%80%93-what-biomedical-computing-can-learn-its-mistakes

Handsome Wife
Feb 17, 2001

Internet Janitor posted:

LabView and Excel, on the other hand, pose some meaningful danger. They allow "non-programmers" to solve useful problems for themselves, which is great, but they're all too often used in production environments. Where you could have a straightforward script in nearly any sane language you instead get a tangled mess that is all but impossible to audit for correctness or instrument for tests.

At a previous job, I worked for a company that supplied monitoring systems for industrial systems. The flagship product was a $35k-per-license piece of software which was a gigantic LabView application written and maintained by a VP who used LabView for everything, including simple one-off scripts. (This wasn't instrument control -- it was purely a UI by which the user monitored data provided by a separate API.)

An impressively large number of bugs was attributable to his hand-rolled serialization and deserialization, which of course he couldn't replace but it would mean having to go through the code and find every place it had been copied to.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
C# code:
if (!CanRejectOrder(orderId))
{
    resp.Message("We're sorry, but order #" + orderId +
                 " can no longer be accepted or rejected.");
}
{
    RejectOrder(orderId);

    resp.Message("You have declined to service Order #" + orderId + ".");
}

Pollyanna
Mar 5, 2005

Milk's on them.


Bognar posted:

C# code:
if (!CanRejectOrder(orderId))
{
    resp.Message("We're sorry, but order #" + orderId +
                 " can no longer be accepted or rejected.");
}
{
    RejectOrder(orderId);

    resp.Message("You have declined to service Order #" + orderId + ".");
}

Whoopsie! :downs:

Space Kablooey
May 6, 2009


Bognar posted:

C# code:
if (!CanRejectOrder(orderId))
{
    resp.Message("We're sorry, but order #" + orderId +
                 " can no longer be accepted or rejected.");
}
{
    RejectOrder(orderId);

    resp.Message("You have declined to service Order #" + orderId + ".");
}

It took me way too long to see the error.

Skyl3lazer
Aug 27, 2007

[Dooting Stealthily]



Bognar posted:

C# code:
if (!CanRejectOrder(orderId))
{
    resp.Message("We're sorry, but order #" + orderId +
                 " can no longer be accepted or rejected.");
}
{
    RejectOrder(orderId);

    resp.Message("You have declined to service Order #" + orderId + ".");
}

Does c# actually allow code to randomly be in {} with no reason?

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Skyl3lazer posted:

Does c# actually allow code to randomly be in {} with no reason?

There's a perfectly valid reason to insert random {} in your code: it creates scope blocks, so you can e.g. declare a variable that's local to that scope and invalid outside of it. It's not (usually) a common thing to do, though, since usually you'd just make a new function to contain your scope instead.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
It's actually really dumb and error-prone, especially since "if true" exists.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

TooMuchAbstraction posted:

There's a perfectly valid reason to insert random {} in your code: it creates scope blocks, so you can e.g. declare a variable that's local to that scope and invalid outside of it. It's not (usually) a common thing to do, though, since usually you'd just make a new function to contain your scope instead.

If you're creating scopes just to contain variables, then you should definitely be using a separate function. Based on that alone I'd advocate for the removal of the feature altogether (although you'd then might want to make changes to other language constructs like switch/case).

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Bognar posted:

If you're creating scopes just to contain variables, then you should definitely be using a separate function. Based on that alone I'd advocate for the removal of the feature altogether (although you'd then might want to make changes to other language constructs like switch/case).

I don't want to create a new function just so I can create a lock (some lock implementations auto-release when the lock object leaves scope).

eth0.n
Jun 1, 2012

TooMuchAbstraction posted:

I don't want to create a new function just so I can create a lock (some lock implementations auto-release when the lock object leaves scope).

I'd rather see a "with" construct; as in:

code:
void foo()
{
    with(Guard g1(lock1); Guard g2(lock2)) {
        // do stuff
    }
}
Makes it clearer what the purpose of the scoping is.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Using explicit scopes just to control the lifetime of variables is super-normal in C++ due to RAII.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Explicit scope is fine but a bare block sucks. Make my fuckups a syntax error.

xzzy
Mar 5, 2009

One of the cleverest (both good and bad types of clever) thing I've seen done with curly braces is in bash, where each pair of curly braces is a subshell. If you string them together with pipes you can create a parallelized event loop.. as subshells produce output the last binary in the pipe reads that and acts upon it.

Annoying to debug if one of the subshells has problems, but it's a fun parlor trick.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

xzzy posted:

One of the cleverest (both good and bad types of clever) thing I've seen done with curly braces is in bash, where each pair of curly braces is a subshell. If you string them together with pipes you can create a parallelized event loop.. as subshells produce output the last binary in the pipe reads that and acts upon it.

Annoying to debug if one of the subshells has problems, but it's a fun parlor trick.

I always wonder why people do fancy stuff in bash. It just seems like it would be so much easier to write/debug in a language like python...but I'm not writing stuff for the shell all the time so maybe there's good reasons.

I do know it irritates the crap out of me when I've got to troubleshoot some service with startup bash scripts hundreds of lines long.

xzzy
Mar 5, 2009

In my experience bash is chosen when someone wants zero dependencies and the ability to run it out of the box on any unix-like system.

Once upon a time we were supporting irix, linux, and solaris.. /bin/sh was the only thing they could be guaranteed to have in common.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
It's also part of the "standard linux education" or whatever that means exactly. A lot of times it's the only scripting language they know.

Strong Sauce
Jul 2, 2003

You know I am not really your father.





Amberskin posted:

Heh, are you and me coworkers perhaps?

I've seen things you would not believe. For instance, developers willingly disabling the compiler's overflow detection just because catching it as an exception is hard. Or something like that.

Overflow detection disabled => truncation.

In a bank.

Regarding to money amounts

:psyboom:

so like this, but with real money.

https://www.ima.umn.edu/~arnold/disasters/ariane.html

TooMuchAbstraction posted:

There's a perfectly valid reason to insert random {} in your code: it creates scope blocks, so you can e.g. declare a variable that's local to that scope and invalid outside of it. It's not (usually) a common thing to do, though, since usually you'd just make a new function to contain your scope instead.


next round of javascript errors

OddObserver
Apr 3, 2009

Thermopyle posted:

I always wonder why people do fancy stuff in bash. It just seems like it would be so much easier to write/debug in a language like python...but I'm not writing stuff for the shell all the time so maybe there's good reasons.


Some of it is like the visual programming discussion above: start with a 10-line script, which would be messier in Python since it's all calls to commands... and then 2 years later it's 1000 lines full of program logic.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

TooMuchAbstraction posted:

There's a perfectly valid reason to insert random {} in your code: it creates scope blocks, so you can e.g. declare a variable that's local to that scope and invalid outside of it. It's not (usually) a common thing to do, though, since usually you'd just make a new function to contain your scope instead.

Why would I create a new function and pass/copy a bunch of state when I could just use RAII and have a scoped lock to get to shared data from where I actually want it?

xtal
Jan 9, 2011

by Fluffdaddy

Thermopyle posted:

I always wonder why people do fancy stuff in bash. It just seems like it would be so much easier to write/debug in a language like python...but I'm not writing stuff for the shell all the time so maybe there's good reasons.

I do know it irritates the crap out of me when I've got to troubleshoot some service with startup bash scripts hundreds of lines long.

Python, Ruby &c don't have good interfaces for working with pipes and subprocesses. cat | cat is like 10 lines in an ugly API.

It helps to think of Bash not as a scripting language but as a DSL for orchestrating programs via pipes. You wouldn't use it for the same things you'd use Python for. Turtle and Scsh are cool things you should look at that sort of bridge this gap.

xtal fucked around with this message at 21:26 on Jun 14, 2016

Klades
Sep 8, 2011

xtal posted:

Python, Ruby &c don't have good interfaces for working with pipes and subprocesses. cat | cat is like 10 lines in an ugly API.

It helps to think of Bash not as a scripting language but as a DSL for orchestrating programs via pipes. You wouldn't use it for the same things you'd use Python for. Turtle and Scsh are cool things you should look at that sort of bridge this gap.

Why in the world would you do cat | cat.
I mean I take your point, if you wanted to do something like grep | grep it would be comparatively messy in a scripting language, but then that's why you can do things like (Ruby, anyway):
code:
somevariable = `grep #{filename} "#{pattern}" | grep "#{pattern2}"`

Nippashish
Nov 2, 2005

Let me see you dance!
I use python with the sh package to basically write the same script I would in bash, but not have to worry about string quoting.

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Nippashish posted:

I use python with the sh package to basically write the same script I would in bash, but not have to worry about string quoting.

drat, that's an awesome package.

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