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
SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal

Jabor posted:

code:
goto *(isWrong() ? &&err : &&continue);
err:
    cerr << "A problem" << endl;
    goto end;
continue:
    
end:
    return;
:q:

Sadly, goto is predictably banned.

There's more though! I have to limit lines to 80 char width. And despite the single point of return thing, I CAN USE EXCEPTIONS. I can only type "return" once, but "throw" many times! :catstare:

Also this thing about function calls in conditionals really fucks while loops:

code:
while(it.hasNext()) {
//some stuff
}
becomes
code:
bool bHasNext = it.hasNext();
while(true == bHasNext)
{
//some stuff
    bHasNext = it.hasNext();
}
:negative:

Adbot
ADBOT LOVES YOU

Groke
Jul 27, 2007
New Adventures In Mom Strength

Zhentar posted:

Millions upon millions of lines of code, decades of data accumulated. Migrating would cost us man-millennia, on top of enormous expense & effort on the part of our customers, and would probably take at least 5-10 years before nearing the stability of our current codebase.

Yeah, exactly.

What does tend to happen is they slap on new layers of user interface with a more modern look and feel, and/or move towards using the old database more as a source for exporting data into other things. But the legacy ware is still lurking somewhere at the bottom and some guy has to be paid to maintain it. Unbeatable job security if you're willing to be the guy who has to dig into uncommented code which is all about variables called VW, VWW, VWWW and so forth.

Groke fucked around with this message at 19:20 on Jun 19, 2012

Zamujasa
Oct 27, 2010



Bread Liar
Well, the boss just explained the method to his madness. Because the joins throughout the code are designed like poo poo (apparently the requirements to work on our code do not include "knowing how to alias a MySQL table/column" or "what mysql_select_db does") he tries to pick hosed up names that are 99.9% guaranteed to not be used anywhere else so that queries don't break with Ambiguous column "butts". (Have I mentioned that our solution to errors is display_errors 0 without actually logging anything yet? And that there's no single include I could hijack to inject a sane error handler? That's probably important.)

Oh well. Having to remember if it's id or id_devices or device_id or deviceid or deviceID is keeps me on my toes. :shepicide:

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Zamujasa posted:

Well, the boss just explained the method to his madness. Because the joins throughout the code are designed like poo poo (apparently the requirements to work on our code do not include "knowing how to alias a MySQL table/column" or "what mysql_select_db does") he tries to pick hosed up names that are 99.9% guaranteed to not be used anywhere else so that queries don't break with Ambiguous column "butts".

Oh well. Having to remember if it's id or id_devices or device_id or deviceid or deviceID is keeps me on my toes. :shepicide:

Is your boss's name Dave? I had a boss named Dave who did exactly this, including modifying production on the fly.

Zamujasa
Oct 27, 2010



Bread Liar

trex eaterofcadrs posted:

Is your boss's name Dave? I had a boss named Dave who did exactly this, including modifying production on the fly.

Thankfully, no. But based on anecdotal evidence, it seems like there are just 50 clones of the same person with different names, who all managed to get programming positions doing their best to throw wrenches into everything.

Strong Sauce
Jul 2, 2003

You know I am not really your father.





Kim Jong III posted:

I've always wondered about jobs with stuff like MUMPS or NATURAL or these languages that are responsible for huge amounts of data but for only like four or five companies in the world.

How do you find this kind of job? What's the outlook like - are companies trying desperately to move away, or is the code base so significant that they'd rather deal with training people?

My friend works at a big defense company (Either Boeing or Raytheon). They have a lot of legacy code that really can't be ported (I'm guessing because of problems Groke mentions, like no testing, no commenting) and the machines that they use to run on no longer exist so he develops emulators for the old systems so it can run the legacy code.

Groke
Jul 27, 2007
New Adventures In Mom Strength

Strong Sauce posted:

My friend works at a big defense company (Either Boeing or Raytheon). They have a lot of legacy code that really can't be ported (I'm guessing because of problems Groke mentions, like no testing, no commenting) and the machines that they use to run on no longer exist so he develops emulators for the old systems so it can run the legacy code.

Haha, Jesus. At least my language is still officially supported and sees new versions and such.

Sonnekki
Mar 14, 2010

Groke posted:

Haha, Jesus. At least my language is still officially supported and sees new versions and such.

Officially supported: that's the key. I do :raise: when official support for large software stacks goes away and the business says no to upgrading for reason R despite security issue S and "it's fixed in the next version".

Bhaal
Jul 13, 2001
I ain't going down alone
Dr. Infant, MD

Groke posted:

Yeah, exactly.

What does tend to happen is they slap on new layers of user interface with a more modern look and feel, and/or move towards using the old database more as a source for exporting data into other things. But the legacy ware is still lurking somewhere at the bottom and some guy has to be paid to maintain it. Unbeatable job security if you're willing to be the guy who has to dig into uncommented code which is all about variables called VW, VWW, VWWW and so forth.
I worked on FilePro at a company for years and very much know how this goes (speaking of variables, its variables are limited to either 1 or 2 characters, a-z only, case insensitive, and are basically registers as there is no such thing as scope). It's something of a riff on the sunk cost fallacy: The company is generally getting on okay with X. X is old, our IT team wants to replace it and says it has limitations that increasingly impact what they can build and provide for the company. But meanwhile X is a living, vital organ for the company, and once again, the company is generally getting on okay with X.

But oh dear god does it come with a whole bouquet of hidden costs. For starters the cost of replacing it tends to increase over time as you put more and more work into it, and the cost of maintaining it goes up disproportionately compared to a similar system implemented in a more modern/sane environment (mitigated somewhat by a fully competent team running the show). You are also in a much tougher hiring market because job seekers with experience in X are a dying breed, so their price tends to go up not to mention the difficulty in finding them period. You can supplement that with solid new hires ready to learn but now you have the cost of a long, steep ramp up process. Oh, don't forget it's a fleeting knowledge base; your team can't exactly use google / stack exchange as a backdrop for those "I'm not sure offhand but I'm certain someone else has come across this" problems that inevitably crop up.

And last but not least, your workers are going to start realizing that pouring years into X is something of a resume dead end. I mean it's still work and shows a lot of good qualities for sticking with something unpleasant for the sake of business and so on. But in the long run they're limiting their employment options in the same way you're limiting your hiring options. If you find one of those hard to find people with previous experience in X, or you spend the 4-6 month ramp up on some new hire to get them productive, you're still looking a substantial risk of losing them within 4-5 years just by the nature of the work they're doing.

Bhaal fucked around with this message at 20:36 on Jun 19, 2012

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Bhaal posted:

And last but not least, your workers are going to start realizing that pouring years into X is something of a resume dead end.

Yup. My career started writing code in a proprietary language called GEMBASE that was only used by an ERP system. Try to find anything in-depth about it on Google; there isn't much.

You pretty much have to hire fresh-out-of-college to get someone to work with a language like that unless they've already been doing it for a while. I wouldn't program in GEMBASE again for any amount of money.

Luckily, toward the end of my tenure at the company we started writing supplemental applications in VB .NET, which led me to my current career as a C# developer.

Zombywuf
Mar 29, 2008

Strong Sauce posted:

My friend works at a big defense company (Either Boeing or Raytheon). They have a lot of legacy code that really can't be ported (I'm guessing because of problems Groke mentions, like no testing, no commenting) and the machines that they use to run on no longer exist so he develops emulators for the old systems so it can run the legacy code.

When I'm a particularly low ebb I think about all the office productivity software that is effectively written as an emulation layer for the business practices of the 1950s and just how much this is holding us back as a civilisation.

Thermopyle
Jul 1, 2003

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

Zombywuf posted:

When I'm a particularly low ebb I think about all the office productivity software that is effectively written as an emulation layer for the business practices of the 1950s and just how much this is holding us back as a civilisation.

+1

Not that I know there's better ways of handling business or whatever, but it always saddens me that so much software is like...well...here's a typewriter on your screen, here's a ledger on your screen, here's a Rolodex on your screen, etc.

Zombywuf
Mar 29, 2008

Thermopyle posted:

+1

Not that I know there's better ways of handling business or whatever, but it always saddens me that so much software is like...well...here's a typewriter on your screen, here's a ledger on your screen, here's a Rolodex on your screen, etc.

Even worse are the ways of simulating the processes of passing documents from person to person with a growing pile of notes stuck to the front. Excel is often used for this. Where MY GF works there is a person who's job is to take forms and turn a list of checkboxes into a binary representation and write it on the form so someone else can type it into a spreadsheet. You see, there's only one copy of the spreadsheet on a shared drive so only one person can edit it at a time. Periodically the spreadsheet is recreated and the previous one sent on to the next stage of the process.

While it is an excellent example of how to deal with contention using the single writer paradigm, it hurts to think of people doing it by hand.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Zombywuf posted:

Even worse are the ways of simulating the processes of passing documents from person to person with a growing pile of notes stuck to the front. Excel is often used for this. Where MY GF works there is a person who's job is to take forms and turn a list of checkboxes into a binary representation and write it on the form so someone else can type it into a spreadsheet. You see, there's only one copy of the spreadsheet on a shared drive so only one person can edit it at a time. Periodically the spreadsheet is recreated and the previous one sent on to the next stage of the process.

While it is an excellent example of how to deal with contention using the single writer paradigm, it hurts to think of people doing it by hand.

I bet if you talk to the people at your GF's company, they'd look at you like you had two heads if you started talking about Google docs.

We moved over from Lotus Notes 6.5.1 to gmail... earlier this year. Lotus Notes was configured so that it was impossible to index your in-box (seriously) and that functionality was locked down by an administrator, so it took like 15 minutes to do a full text search of an inbox. Seriously. Yet when we moved over, everyone started complaining about GMail sucked - for the first 3 weeks after we moved over to gmail, the IT director would shout "gently caress GMAIL" across the entire office at 4 PM in the afternoon like clockwork every single day...

Look Around You
Jan 19, 2009

hieronymus posted:

I bet if you talk to the people at your GF's company, they'd look at you like you had two heads if you started talking about Google docs.

We moved over from Lotus Notes 6.5.1 to gmail... earlier this year. Lotus Notes was configured so that it was impossible to index your in-box (seriously) and that functionality was locked down by an administrator, so it took like 15 minutes to do a full text search of an inbox. Seriously. Yet when we moved over, everyone started complaining about GMail sucked - for the first 3 weeks after we moved over to gmail, the IT director would shout "gently caress GMAIL" across the entire office at 4 PM in the afternoon like clockwork every single day...

HIPAA could be a major concern for migration to Google Docs (apart from pre-existing data, etc), no?

ijustam
Jun 20, 2005

Zombywuf posted:

Even worse are the ways of simulating the processes of passing documents from person to person with a growing pile of notes stuck to the front. Excel is often used for this. Where MY GF works there is a person who's job is to take forms and turn a list of checkboxes into a binary representation and write it on the form so someone else can type it into a spreadsheet. You see, there's only one copy of the spreadsheet on a shared drive so only one person can edit it at a time. Periodically the spreadsheet is recreated and the previous one sent on to the next stage of the process.

While it is an excellent example of how to deal with contention using the single writer paradigm, it hurts to think of people doing it by hand.

This is where some jerk who knows just enough to be destructive comes in and suggests SharePoint because versioning.

Zombywuf
Mar 29, 2008

hieronymus posted:

I bet if you talk to the people at your GF's company, they'd look at you like you had two heads if you started talking about Google docs.

It's the civil service, their major complaint about Google Docs is that it doesn't work in IE6. Their internal web apps (where data is copied by hand from and to spreadsheets) only work in IE6 so it's mandatory.

MrMoo
Sep 14, 2000

So install Google Chrome Frame: that is why it exists?

uncleTomOfFinland
May 25, 2008

I love how the internal error page of one of our systems says we've been notified about this issue and will look at it shortly even though even the developers can't access those errors.

door.jar
Mar 17, 2010

Zombywuf posted:

Even worse are the ways of simulating the processes of passing documents from person to person with a growing pile of notes stuck to the front. Excel is often used for this.

I work with an application that was created from the ground up to support workflows involving typists creating electronic documents based on handwritten notes.

It goes something like this:
1. A handwritten document is created and scanned into the system using a mostly automated process.
2. The document arrives in a work queue where it is eventually picked up by a typist.
3. The typist types up the document based on the scanned document (for extra hilarity this step does not support multiple monitors) using some kind of crazy Word hook-in.
4. The typed document is then sent for approval, if approved it is converted to PDF and stored. If declined it is sent back to step 3 with notes on fixes.

And yes, there are still typists employed by the company. Not enough and so some people are both users and typists and perform all the steps themselves to keep the "processes aligned", this includes logging out and in to switch users halfway through.

zeekner
Jul 14, 2007

Zamujasa posted:

I'd consider another job but right now I've worked hard for my lowly $15/hour wage. At least I have benefits, even if they do come out of my paycheck at the end of the week.

Hey, stop selling yourself short. If your competent enough to point out those flaws, you're probably worth more than $15/hr. Seriously, IT helpdesk people make more than that.

Even if you are dangerously incompetent you could still make $25/hr like any bog-standard PHP developer.

Zamujasa
Oct 27, 2010



Bread Liar

Geekner posted:

Hey, stop selling yourself short. If your competent enough to point out those flaws, you're probably worth more than $15/hr. Seriously, IT helpdesk people make more than that.

Even if you are dangerously incompetent you could still make $25/hr like any bog-standard PHP developer.

I've been tempted to ask for a raise recently (I know other people they have considered hiring on at $60K/year) but things have been incredibly hectic for the last several weeks and I haven't managed to get above water in terms of project due dates. "Surprise, now we're doing __________ instead of __________" and we have about 50 things that are on the to-do list but never actually get done because they change directions almost every other day.

Things should cool down a bit in the next week or two. If they don't, then... :negative:

Zombywuf
Mar 29, 2008

MrMoo posted:

So install Google Chrome Frame: that is why it exists?

Users? Install software on their own machines?

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:

SavageMessiah posted:

There's more though! I have to limit lines to 80 char width. And despite the single point of return thing, I CAN USE EXCEPTIONS. I can only type "return" once, but "throw" many times! :catstare:

Whenever you'd want to do a return just stick your return value in an exception and throw it. Then wrap the entire method in a try/catch block, extract the return value and return it. Single point of exit. :smug:

LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer
God drat do I hate "single point of exit" as a design philosophy. It's the cause of conditional blocks the size of skyscrapers that are impossible to parse when all you need is if (gently caress == null) return false;

Granted, this only happens if the code is also full of massive functions. It's probably okay to use single point of exit if you manage to keep functions small, and it's probably (somewhat) okay to make a lot of long functions if you can make them readable, but combine single point of exit with behemoth functions and you have planted the seeds of despair.

Blacknose
Jul 28, 2006

Meet frustration face to face
A point of view creates more waves
So lose some sleep and say you tried

dwazegek posted:

Whenever you'd want to do a return just stick your return value in an exception and throw it. Then wrap the entire method in a try/catch block, extract the return value and return it. Single point of exit. :smug:

Make sure to use the smuggest face possible when explaining what you've done.

ToxicFrog
Apr 26, 2008


LOOK I AM A TURTLE posted:

God drat do I hate "single point of exit" as a design philosophy. It's the cause of conditional blocks the size of skyscrapers that are impossible to parse when all you need is if (gently caress == null) return false;

Granted, this only happens if the code is also full of massive functions. It's probably okay to use single point of exit if you manage to keep functions small, and it's probably (somewhat) okay to make a lot of long functions if you can make them readable, but combine single point of exit with behemoth functions and you have planted the seeds of despair.

As I understand it, "single point of exit" was once - back in the unstructured programming days when things like "subroutines" were more a matter of programmer convention than a language feature - "single point of entry, single point of exit". It was a mantra encouraging programmers not only to arrange their code into subroutines, but also to avoid jumping into or out of the middle of them, making control flow (and stack management) impossible to follow.

Of course, structured programming won and these days "single point of entry" has withered away like the useless appendage it is. "Single point of exit", however, is still with us, making GBS threads up coding styles far and wide. :argh:

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:
It could also conceivably make cleanup easier, if there's only one point where your code can exit a function, then there's also only one point where you need to de-allocate resources etc.

Of course, now (almost) every language has far better methods for doing this. Not to mention that the very presence of exceptions means you might not be able to rely on your single point of exit (and thus your cleanup) ever executing.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

ToxicFrog posted:


Of course, structured programming won and these days "single point of entry" has withered away like the useless appendage it is. "Single point of exit", however, is still with us, making GBS threads up coding styles far and wide. :argh:

Let me tell you about the goto statement and also what it is considered:

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
So I had to poke around in a homegrown CMS system that a client's old web dev shop wrote ~6 years ago. It is full of horrors, but the README file takes the cake:

code:
THIS IS OUT OF DATE: UPDATE WITH INFO ABOUT HOW THIS WORKS!

This directory holds files that will eventually become actual documents on
a website: the editor scripts, etc.
:suicide:

PrBacterio
Jul 19, 2000

door.jar posted:

I work with an application that was created from the ground up to support workflows involving typists creating electronic documents based on handwritten notes.

It goes something like this:
1. A handwritten document is created and scanned into the system using a mostly automated process.
2. The document arrives in a work queue where it is eventually picked up by a typist.
3. The typist types up the document based on the scanned document (for extra hilarity this step does not support multiple monitors) using some kind of crazy Word hook-in.
4. The typed document is then sent for approval, if approved it is converted to PDF and stored. If declined it is sent back to step 3 with notes on fixes.

And yes, there are still typists employed by the company. Not enough and so some people are both users and typists and perform all the steps themselves to keep the "processes aligned", this includes logging out and in to switch users halfway through.
:psyduck: That sounds like something out of the era of punched cards with operators typing up the source code written by programmers from coding forms onto cards using keypunches.

Suspicious Dish
Sep 24, 2011

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

dwazegek posted:

It could also conceivably make cleanup easier, if there's only one point where your code can exit a function, then there's also only one point where you need to de-allocate resources etc

I'm curious how people feel about the goto statement as an approach to this.

C++ code:
char *
grab_http_response(char *string_url)
{
  char *response = NULL;
  URL *url = NULL;
  my_socket *sock = NULL;
  char *request;

  url = parse_url (string_url, url);
  if (url == NULL)
    goto out;

  sock = my_socket_open (url->host, url->port);
  if (sock != NULL)
    goto out;

  request = asprintf ("HTTP 1.1\nGET %s", url->path);
  my_socket_send (sock, request);

  response = my_socket_recvall (sock);

 out:
  if (sock != NULL)
    my_socket_close (sock);
  if (url != NULL)
    free (url);

  return response;
}
Yes, I know, it's an "HTTP client". The code is probably incorrect, too. It was the simplest example that I think everybody would understand that required multiple resources to be closed in an error path.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I prefer multiple labels rather than the checks for each variable (and free(NULL) is required to be a no-op so the check there is pointless and dumb), but in general that's the only sane approach I've seen in C.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Suspicious Dish posted:

I'm curious how people feel about the goto statement as an approach to this.

C++ code:
Yes, I know, it's an "HTTP client". The code is probably incorrect, too. It was the simplest example that I think everybody would understand that required multiple resources to be closed in an error path.

It's a shame that C++ doesn't have a finally construct.

pseudorandom name
May 6, 2007

The usual way to do it is to have out_socket_close and out_free_url labels instead of having extra conditions in the exit path.

edit: beaten.

ijustam
Jun 20, 2005

If you ever see 'php' and 'mysql' tags next to each other in Stack Overflow you can guarantee whatever is inside is a horror.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Ithaqua posted:

It's a shame that C++ doesn't have a finally construct.
I can't remember the last time I actually wanted finally in C++. RAII is nearly always better.

Vanadium
Jan 8, 2005

I wouldn't mind finally when using C APIs to a small enough extent that wrapping them in RAII would be a hassle, or even to reset some std::ostream formatting state.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
It's not very hard to write a generic RAII container for c api things:
C++ code:
template<class T, class Del = void(*)(T)>
class scoped_holder {
	T value;
	Del destructor;

	scoped_holder(scoped_holder const&);
	scoped_holder& operator=(scoped_holder const&);
public:
	operator T() const { return value; }
	T operator->() const { return value; }

	scoped_holder(T value, Del destructor)
	: value(value)
	, destructor(destructor)
	{
	}

	~scoped_holder() { if (value) destructor(value); }
};

...

{
  scoped_holder<api_handle_type> handle(api_alloc_a_thing(), api_delete_a_thing);
  if (!handle)
    return;

  api_do_stuff_with_a_thing(handle);
}

Adbot
ADBOT LOVES YOU

No Safe Word
Feb 26, 2005

ijustam posted:

If you ever see 'php' and 'mysql' tags next to each other in Stack Overflow you can guarantee whatever is inside is a horror.

Yeah though I mean 99% of Stack Overflow is a horror anyway, those tags just ensure the deck is fully stacked.

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