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
Klades
Sep 8, 2011

http://www.aoc.nrao.edu/php/tjuerges/ALMA/ACE-5.5.2/html/ace/OS__main_8h-source.html

This entire framework makes me want to fight somebody.

Adbot
ADBOT LOVES YOU

VikingofRock
Aug 24, 2008




Today in academia I saw a presentation that contained some code. All the variables were named things like "rhocxaRfpup" and "rhocxaIfpup" (both exact quotes).

Absurd Alhazred
Mar 27, 2010

by Athanatos

VikingofRock posted:

Today in academia I saw a presentation that contained some code. All the variables were named things like "rhocxaRfpup" and "rhocxaIfpup" (both exact quotes).

Was this computational chemistry, by any chance?

VikingofRock
Aug 24, 2008




Absurd Alhazred posted:

Was this computational chemistry, by any chance?

Solid state physics. Why do you ask?

Absurd Alhazred
Mar 27, 2010

by Athanatos

VikingofRock posted:

Solid state physics. Why do you ask?

"rho" combined with stuff that looked like it might be molecule names made me think it was some kind of time-dependent molecular density calculation.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
rho is a common character to use as a constant in math and cs too. there's an o(n) median finding algorithm for unsorted arrays where the complexity is really o(rho*n) to hide that fact that rho is a constant factor of like 137 making it completely worthless compared to just doing a merge sort.

Absurd Alhazred
Mar 27, 2010

by Athanatos

LeftistMuslimObama posted:

rho is a common character to use as a constant in math and cs too. there's an o(n) median finding algorithm for unsorted arrays where the complexity is really o(rho*n) to hide that fact that rho is a constant factor of like 137 making it completely worthless compared to just doing a merge sort.

Yeah, but would you use it to name a variable? It immediately jumped out at me as a density. :shrug:

eth0.n
Jun 1, 2012

I'm on a project that uses this. Fortunately, at the level I work, I'm normally insulated from it. We use its build system, though, which is a pain. It's a cross platform thing (written in Perl) which generates build files for various systems. It works OK for VS, but the makefiles it generates suck. No header-dependency-change detection, so you have to do a full rebuild to be safe. I ended up hacking in .d file stuff myself. Also, the "clean" doesn't clean everything you'd expect from a typical makefile setup; you have to remember to do realclean, or you'll get surprised.

The biggest horror I've seen from ACE itself, though, is ACE_Guard. Unlike every other guard you'll find for C++, this isn't safe:

code:
int foo(ACE_Mutex &mutex)
{
  ACE_Guard<ACE_Mutex> guard(mutex);
  /* do stuff */
}
Because for some reason, the constructor is allowed to fail. Why it would ever fail is a mystery, but the docs say it can (at least in the current version; version you linked doesn't, but suspect it has the same behavior). So you have to do this instead:

code:
int foo(ACE_Mutex &mutex)
{
  ACE_Guard<ACE_Mutex> guard(mutex);
  if(guard.locked())
  {
    /* do stuff */
  }
  else
  {
    /* "handle" the error, somehow */
  }
}
What's extra fun is the docs tell you ACE_GUARD_RETURN and ACE_GUARD_REACTION can "help" with handling the error, but those macros have no documentation.


Also, prefixing everything with ACE_ (inside an ACE namespace...), and the Capitalized_Words_With_Underscores convention is super ugly.

Absurd Alhazred
Mar 27, 2010

by Athanatos

eth0.n posted:

Also, prefixing everything with ACE_ (inside an ACE namespace...), and the Capitalized_Words_With_Underscores convention is super ugly.

Explicit namespacing and "using" is one of the things I like about C# (and implicit namespacing through directory placement is what I really don't like about Java).

Klades
Sep 8, 2011

eth0.n posted:

<horrible ACE stuff>

Yeah, the project I'm on is mostly written in a similar style to ACE (and has a heap of ACE and CORBA-related frameworks involved) and as an added bonus, is C++03 only. It's my experience so far that ACE is a muddled, mostly undocumented wreck and a complete pain to sort through.

I think the ACE_ naming thing is because ACE's first release was three years after C++ first got namespaces, and I don't get the impression that they move quickly to adopt new language features. I'd be hard pressed to even tell you what ACE gives you that the standard library can't at this point, but then I'm not exactly a C++ guru or anything.

eth0.n posted:

I'm on a project that uses this. Fortunately, at the level I work, I'm normally insulated from it. We use its build system, though, which is a pain. It's a cross platform thing (written in Perl) which generates build files for various systems. It works OK for VS, but the makefiles it generates suck. No header-dependency-change detection, so you have to do a full rebuild to be safe. I ended up hacking in .d file stuff myself. Also, the "clean" doesn't clean everything you'd expect from a typical makefile setup; you have to remember to do realclean, or you'll get surprised.

Have you tried "make depend"? Or was it "make depends", I forget. Either way, I was having an issue with it not recompiling template code until I ran that and now it seems to be fine. Not that I actually work on the thing in Linux, because the massive clusterfuck of #defines ACE is made out of and the "include .cpp file in .h for templates" style both make the clang static analyzer cry, which in turn makes my syntax highlighting in vim absolutely poo poo the bed, which makes editing the code there unpleasant.

eth0.n
Jun 1, 2012

Klades posted:

I'd be hard pressed to even tell you what ACE gives you that the standard library can't at this point, but then I'm not exactly a C++ guru or anything.

We use it for cross-platform locking, threading, and networking. Hopefully we'll switch the locking and threading to C++11 (we might), and ideally we'd use asio for networking, but I doubt that'll happen.

quote:

Have you tried "make depend"? Or was it "make depends", I forget. Either way, I was having an issue with it not recompiling template code until I ran that and now it seems to be fine. Not that I actually work on the thing in Linux, because the massive clusterfuck of #defines ACE is made out of and the "include .cpp file in .h for templates" style both make the clang static analyzer cry, which in turn makes my syntax highlighting in vim absolutely poo poo the bed, which makes editing the code there unpleasant.

Interesting; will have to give that a try. Of course, the fact that I was looking specifically for that in the docs, and couldn't find it, and it isn't done by default like any sane makefile, is still bad...

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

Absurd Alhazred posted:

What about a >oo < operator?
What we need is the ¯\_(ツ)_/¯ operator.

Soricidus
Oct 21, 2010
freedom-hating statist shill
I'd write it as E°( )∃

VikingofRock
Aug 24, 2008




Absurd Alhazred posted:

Yeah, but would you use it to name a variable? It immediately jumped out at me as a density. :shrug:

The rho did correspond to a rho in a relevant equation, and the "up" at the end corresponded to the number of particles in a spin up state. That's as far as I got though. Honestly it might not have been a horror in context, but I did think it was pretty amusing!

feedmegin
Jul 30, 2008

Klades posted:

Yeah, the project I'm on is mostly written in a similar style to ACE (and has a heap of ACE and CORBA-related frameworks involved) and as an added bonus, is C++03 only. It's my experience so far that ACE is a muddled, mostly undocumented wreck and a complete pain to sort through.

I think the ACE_ naming thing is because ACE's first release was three years after C++ first got namespaces, and I don't get the impression that they move quickly to adopt new language features. I'd be hard pressed to even tell you what ACE gives you that the standard library can't at this point, but then I'm not exactly a C++ guru or anything.


Have you tried "make depend"? Or was it "make depends", I forget. Either way, I was having an issue with it not recompiling template code until I ran that and now it seems to be fine. Not that I actually work on the thing in Linux, because the massive clusterfuck of #defines ACE is made out of and the "include .cpp file in .h for templates" style both make the clang static analyzer cry, which in turn makes my syntax highlighting in vim absolutely poo poo the bed, which makes editing the code there unpleasant.

Sup ACE/TAO horror buddies. I'm moving our ACE-using legacy stuff to new compilers (no more gcc 3.4!) - but bear in mind not all of us have the luxury of an up-to-date standard library. We can't use gcc on AIX (miscompiles our stuff) so we have to use IBM's xlc compiler - which claims partial C++11 compliance but doesn't have std::shared_ptr (it's in std::tr1). Or std::unique_ptr at all. Or std::move.

Anyway, we actually use CORBA (the TAO part of ACE/TAO) so dropping ACE is not exactly an option!

Xarn
Jun 26, 2015

eth0.n posted:

... Also, the "clean" doesn't clean everything you'd expect from a typical makefile setup; you have to remember to do realclean, or you'll get surprised.

Nice to see the naming tradition that brought us mysqli_real_escape_string is still alive and well.

feedmegin posted:

Sup ACE/TAO horror buddies. I'm moving our ACE-using legacy stuff to new compilers (no more gcc 3.4!) - but bear in mind not all of us have the luxury of an up-to-date standard library. We can't use gcc on AIX (miscompiles our stuff) so we have to use IBM's xlc compiler - which claims partial C++11 compliance but doesn't have std::shared_ptr (it's in std::tr1). Or std::unique_ptr at all. Or std::move.

Anyway, we actually use CORBA (the TAO part of ACE/TAO) so dropping ACE is not exactly an option!

Eh, if it supports C++11 but only libraries are missing, you should be able to write unique_ptr etc easily. Its shared_ptr thats gonna get ya.

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

VikingofRock posted:

The rho did correspond to a rho in a relevant equation, and the "up" at the end corresponded to the number of particles in a spin up state. That's as far as I got though. Honestly it might not have been a horror in context, but I did think it was pretty amusing!

These problems always come up when trying to translate a paper or standard equation into code. The equations are often written using single (often greek) letters, so do you translate that literally or try to come up with some sort of meaningful name? The latter might seem more obvious to a programmer but there are often intermediate equations that have no meaningful term attached to them, or you end up with variable names or lines of code that are extremely unwieldily.

At the very least though you should use underscores or camel casing. rhocxaRfpup is a bit much.

feedmegin
Jul 30, 2008

Xarn posted:

Eh, if it supports C++11 but only libraries are missing, you should be able to write unique_ptr etc easily. Its shared_ptr thats gonna get ya.

Which is basically what I did, yeah. It's still a rather fundamental thing to be missing especially since move constructors do seem to be in there. My theory is the actual compiler team at IBM is good/competent/staffed, it even handles lambdas and stuff, but the people maintaining the C++ library to go with it are a separate team that's been downsized/is poo poo. :smith:

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal
:aaa:



More of an error message horror I suppose

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Knyteguy posted:

:aaa:



More of an error message horror I suppose

one time i tried to join a string with a numeric type that didnt implement toString(). it was a cat-astrophe.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

LeftistMuslimObama posted:

one time i tried to join a string with a numeric type that didnt implement toString(). it was a cat-astrophe.

:frogout:

raminasi
Jan 25, 2005

a last drink with no ice

Knyteguy posted:

:aaa:



More of an error message horror I suppose

The WPF designer definitely counts as a horror.

BigRedDot
Mar 6, 2008

feedmegin posted:

Sup ACE/TAO horror buddies. I'm moving our ACE-using legacy stuff to new compilers (no more gcc 3.4!) - but bear in mind not all of us have the luxury of an up-to-date standard library. We can't use gcc on AIX (miscompiles our stuff) so we have to use IBM's xlc compiler - which claims partial C++11 compliance but doesn't have std::shared_ptr (it's in std::tr1). Or std::unique_ptr at all. Or std::move.

Anyway, we actually use CORBA (the TAO part of ACE/TAO) so dropping ACE is not exactly an option!

Oh god it's been almost ten years and you just gave me terrible flashbacks...

Absurd Alhazred
Mar 27, 2010

by Athanatos
https://twitter.com/Jonathan_Blow/status/741424368530554881

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
MakeIntResourceAEx(i, NULL, NULL, NULL, NULL, NULL, hWnd);

Beef
Jul 26, 2004
I've only briefly touched windows.h in my career, but the carnaval parade of null pointers is a dead giveaway you are dealing with windows API code.

Linear Zoetrope
Nov 28, 2011

A hero must cook
OpenCL and Vulkan also have a rather annoying pattern that relies on nulls:

code:
int count;
clMakeABufferOrSomething(TYPE, NULL, &count);

char buf[count];
clMakeABufferOrSomething(TYPE, &buf, &count);
Basically, if you call a function with a null pointer to some buffer memory or something, then the function becomes a request to fill the count variable with the size needed for the buffer. If it's a non-null pointer, it instead READS the count argument and reads or writes that many slots of the buffer.

Vulkan also has quite a few "this argument must always be null" requirements in its API specification, though I assume they're there either for backwards compatibility with old alpha implementations or else they plan to have those arguments do something in future extensions.

TheresaJayne
Jul 1, 2011

LeftistMuslimObama posted:

one time i tried to join a string with a numeric type that didnt implement toString(). it was a cat-astrophe.

wouldn't that actually be a concat-astrophe

xzzy
Mar 5, 2009

Literal spaghetti code:



(it's a blueprint from unreal engine 4, which is their visual scripting implementation)

Soricidus
Oct 21, 2010
freedom-hating statist shill

xzzy posted:

visual scripting

This will never not be a terrible idea, and people will never stop trying it regardless.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
when we are all replaced with robots hr will make vizio charts to run the company.

raminasi
Jan 25, 2005

a last drink with no ice

Soricidus posted:

This will never not be a terrible idea, and people will never stop trying it regardless.

If you mean what I think you do, it's a fantastic gateway drug for getting non-programmers into programming, because they don't realize they're programming.

Naturally, everything they create belongs in this thread, but I think the tradeoff is worth it :shobon:

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Visual scripting systems seem simple for trivial tasks and explode into horrors when employed to perform complex tasks. The apparent simplicity of visual scripting for stuff like a fahrenheit to celsius temperature converter is why the idea will never stop being reinvented. Unfortunately, when you start dealing with the expressive power of a real programming language you also deal with the parts that make programming intrinsically hard- algorithmic thinking, factoring apart complex problems, etc.

Based on my teaching experience I'm dubious of the importance of things like Scratch, as they only prevent the most trivial types of syntax error at the cost of making entering and modifying code a slow, tedious process of endless clicking and dragging. You avoid some pitfalls initially, but make experimenting more painful over a longer term. The layout of visual programs is at least as problematic and time-consuming as whitespace and formatting in text-based languages. Still, Scratch and its ilk are explicitly designed as sandboxes for experimentation- there's very little at stake and everyone who enjoys Scratch will eventually graduate to other tools. No harm done.

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.

Pollyanna
Mar 5, 2005

Milk's on them.


Sadness is being handed a lovely irregular CSV and told to write an auto-importer for it. :gonk:

eth0.n
Jun 1, 2012

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.

Also, Access. I worked at a place where everyone was a "data analyst", and only knew Access with VBA macros, and SAS. Any UI stuff had to be done using Access, which is OK for simple data entry, but I was tasked with a multi-site research study, where patients would answer a survey form at each visit on a tablet (old-school Windows XP tablet).

This had to be implemented in Access, and I couldn't even use an SQL server. It ended up being a bunch of client Access DBs hooked up to a backend Access DB sitting on a network file share.

nielsm
Jun 1, 2009



eth0.n posted:

Also, Access. I worked at a place where everyone was a "data analyst", and only knew Access with VBA macros, and SAS. Any UI stuff had to be done using Access, which is OK for simple data entry, but I was tasked with a multi-site research study, where patients would answer a survey form at each visit on a tablet (old-school Windows XP tablet).

This had to be implemented in Access, and I couldn't even use an SQL server. It ended up being a bunch of client Access DBs hooked up to a backend Access DB sitting on a network file share.

Better than storing data collected on each machine and then manually merging at the end of the day.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I actually kinda like this because spaghetti code actually looks like spaghetti in these languages.

Most of these tools have support for abstractions like making your own blocks, so it's not like it's impossible to make clean "visual code", but bad code is possible in any languages.

Perhaps this, combined with a two-way textual DSL, would make this style a bit better. That way, you can "switch gears" to a textual form for more intensive refactoring tasks. But I often use flow graphs and other aids when writing large, complex code myself.

I think it's a space that should be explored further, but I agree that the current tooling around it is horrendous clicking and dragging.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Suspicious Dish posted:

I actually kinda like this because spaghetti code actually looks like spaghetti in these languages.

Most of these tools have support for abstractions like making your own blocks, so it's not like it's impossible to make clean "visual code", but bad code is possible in any languages.

Perhaps this, combined with a two-way textual DSL, would make this style a bit better. That way, you can "switch gears" to a textual form for more intensive refactoring tasks. But I often use flow graphs and other aids when writing large, complex code myself.

I think it's a space that should be explored further, but I agree that the current tooling around it is horrendous clicking and dragging.

yeah ... I will grant that there are interesting possibilities. but the problem with all this is that this kind of thing is invariably designed as a way for non-programmers to program, not as a tool to aid experienced programmers with large complex code.

non-programmers are not going to use abstractions like making their own blocks.

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
We very briefly contemplated trying to make an explicitly scope-limited visual programming system for our project at work, since it's used by a lot of scientists who are not skilled programmers. Then we saw a competitor's attempt at the same idea, which was plenty enough to dissuade us.

Adbot
ADBOT LOVES YOU

canis minor
May 4, 2011

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.

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.

eth0.n posted:

Also, Access. I worked at a place where everyone was a "data analyst", and only knew Access with VBA macros, and SAS. Any UI stuff had to be done using Access, which is OK for simple data entry, but I was tasked with a multi-site research study, where patients would answer a survey form at each visit on a tablet (old-school Windows XP tablet).

This had to be implemented in Access, and I couldn't even use an SQL server. It ended up being a bunch of client Access DBs hooked up to a backend Access DB sitting on a network file share.

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:

canis minor fucked around with this message at 21:59 on Jun 13, 2016

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