|
Fortunately I didn't list "posting in the right thread" on my resume.
|
# ? Apr 28, 2015 00:11 |
|
|
# ? Jun 7, 2024 09:17 |
|
Yeah I'm definitely getting the gently caress out of this place. So like globals are bad in PHP, yeah, since it's really unsafe mutable state. But normally you only really have to worry about stuff happening in your top-level file, since that's usually where your globals get pulled from. php:<? function close_invoice_proc(...) { global $checknum_storage; ... $checknum_storage = array(); ... $controlnum = maintain_checknums($row); ... updateFinalResults($database, $userid, $output, $checknum_storage); .... } ?> See that innocuous-seeming function call in the middle? php:<? function maintain_checknums($row) { global $checknum_storage; ... // do stuff to $checknum_storage } ?>
|
# ? Apr 29, 2015 17:00 |
|
That is one hell of a booby trap. That has to be malice, right?
|
# ? Apr 29, 2015 17:22 |
|
xzzy posted:That is one hell of a booby trap. That has to be malice, right? It looks like mathperson code. Here's some mathperson code from my company (variable names changed to protect the innocent) code:
|
# ? Apr 29, 2015 17:35 |
|
xzzy posted:That is one hell of a booby trap. That has to be malice, right? LeftistMuslimObama posted:It looks like mathperson code. Nope, just massive idiocy. I've sat down with the guy who wrote this (and other stuff that was slightly less bad) to explain why globals are bad. I tried to explain that if you add mutable state you get data that you can't trust, and his response was "I know you can't trust it, that's why when I write my functions I check the values first." php:<? global $database, $checknum_storage, $current_date_time, $current_date; extract($row); if (!isset($mastercustcode_custcode)) { $mastercustcode_custcode = $custcode; } if (!isset($current_date_time)) { $current_date_time = date('H:i:s', strtotime(date('Y/m/d H:i:s'))); } if (!isset($current_date)) { $current_date = date('m/d/Y', strtotime(date('Y/m/d H:i:s'))); } ?>
|
# ? Apr 29, 2015 17:43 |
|
I wonder how many times he writes that validation code before he realizes he could save a lot of typing by breaking it off into its own function. That relies on globals, of course.
|
# ? Apr 29, 2015 17:47 |
|
LeftistMuslimObama posted:It looks like mathperson code. Here's some mathperson code from my company (variable names changed to protect the innocent) I have to deal with this kind of poo poo pretty frequently where I work. It seems like all of the really good Fortran libraries were written by nice people who commented their highly-optimized code, and then everyone else decided to just scrawl their name at the top and write code that's as obfuscated as possible. I once had to gently caress around with a Fortran function that took as input 17 variables, all named a single letter, with no comments or documentation, and the original author died over a decade ago.
|
# ? Apr 29, 2015 18:35 |
|
xzzy posted:I wonder how many times he writes that validation code before he realizes he could save a lot of typing by breaking it off into its own function. That relies on globals, of course. Yeah he just stopped writing validation code completely instead. I realized a while ago that the reason he writes all of these crazy globals is that he keeps ending up with functions that have a dozen parameters or more. This frustrates him (since he calls these functions everywhere, and he'd have to keep writing these parameters all the time), but instead of doing anything sane to fix it, he just hides all the variables instead. Edit: The extra-fun problem is that because his functions do everything at once, refactoring this is extraordinarily hard. I wish it was as simple as just adding these globals to the function signature and fix the calls, but half the time that doesn't work - some of the variables are already used, or he intermingles local and global state, making it gently caress near impossible to understand if what you are adding is going to break everything. IT BEGINS fucked around with this message at 20:00 on Apr 29, 2015 |
# ? Apr 29, 2015 19:26 |
|
I expected a detour into Turing machine land populated solely by globally manipulating validator functions acting as bumpers in a game of multiball pinball (this is multithreaded, right?) where the function pointers are the ballz and the main thread just stands there madly tilting and screaming to no discernable effect.
|
# ? Apr 29, 2015 21:09 |
|
IT BEGINS posted:Yeah he just stopped writing validation code completely instead. Does no one in a management position at this place have any insight into the lack of quality control and the consequences over time in terms of retaining good devs and being able to continue development at whatever pace they keep at the moment? It sounds like they are unaware of how badly they're setting themselves up to get screwed by this.
|
# ? Apr 29, 2015 23:31 |
|
Hammerite posted:Does no one in a management position at this place have any insight into the lack of quality control and the consequences over time in terms of retaining good devs and being able to continue development at whatever pace they keep at the moment? It sounds like they are unaware of how badly they're setting themselves up to get screwed by this. If the situation is that bad and management isn't already addressing it, odds are they're too dumb to judge what is going on and will interpret any action taken by IT BEGINS to be negative and blame him/her. The team will also take any such action as an attack and work to undermine him/her on a personal and professional level. It's a lose-lose-lose situation, that's why those of us with experience say to bail and find another job.
|
# ? Apr 29, 2015 23:45 |
|
Ender.uNF posted:If the situation is that bad and management isn't already addressing it, odds are they're too dumb to judge what is going on and will interpret any action taken by IT BEGINS to be negative and blame him/her. The team will also take any such action as an attack and work to undermine him/her on a personal and professional level. It's a lose-lose-lose situation, that's why those of us with experience say to bail and find another job. Luckily I'm on good terms with management and I'm making my concerns heard. The problem is it doesn't really go anywhere. Our non-technical manager listens to our concerns but our 'CTO' is the owner and there's a ton of push-back to getting this stuff fixed. Also a lot of this stuff was written by his son so yaaaaaaay. Yeah I'm bailing ASAP. Thanks to everyone in this thread, by the way, for making me finally realize I'm on a sinking ship. IT BEGINS fucked around with this message at 00:46 on Apr 30, 2015 |
# ? Apr 30, 2015 00:43 |
|
IT BEGINS posted:'CTO' is the owner and... a lot of this stuff was written by his son. Thanks for your service to this thread
|
# ? Apr 30, 2015 00:47 |
|
IT BEGINS posted:Luckily I'm on good terms with management and I'm making my concerns heard. The problem is it doesn't really go anywhere. Our non-technical manager listens to our concerns but our 'CTO' is the owner and there's a ton of push-back to getting this stuff fixed. Also a lot of this stuff was written by his son so yaaaaaaay. Jesus dude, that's awful.
|
# ? Apr 30, 2015 01:34 |
|
IT BEGINS posted:Yeah I'm bailing ASAP. Thanks to everyone in this thread, by the way, for making me finally realize I'm on a sinking ship. A goon finally started climbing out of their well
|
# ? Apr 30, 2015 01:53 |
|
apseudonym posted:Jesus dude, that's awful. Yeah it's pretty poo poo. I mean it took until TYOOL 2015 to convince said CTO that classes are important to use. That using extract() at the start of every function is a bad idea. That using global only hides parameters and only makes the code worse (he's still convinced that global $database is fine, even though I have given him several specific examples where it cost us hours of work hunting down bugs). There's also still basically no understanding of separation of concerns, or programming patterns. I spent several hours last week explaining that the PHP templates that we feed our reporting system shouldn't be tracked in a separate repository because they are a part of our core piece of software. One of the first responses was 'just add that directory to the include path'. Also, more genius stuff: php:<? function round1 ($string) { return round($string,1); } function round2 ($string) { return round($string,2); } function round3 ($string) { setlocale(LC_MONETARY, 'en_US'); return money_format('%.3n', $string); } function round4 ($string) { setlocale(LC_MONETARY, 'en_US'); return money_format('%.4n', $string); } function round5 ($string) { setlocale(LC_MONETARY, 'en_US'); return money_format('%.5n', $string); } ?>
|
# ? Apr 30, 2015 02:02 |
|
As a mental health advocate, I recommend you start interviewing everywhere that will answer the phone.
|
# ? Apr 30, 2015 02:24 |
|
I saw a SQL query today with six CTEs. Three of which were named sum1, sum2, and sum3.
|
# ? Apr 30, 2015 03:04 |
|
Get a new job that doesn't involve PHP.
|
# ? Apr 30, 2015 07:45 |
|
Get a new job that doesn't involve people.
|
# ? Apr 30, 2015 08:49 |
|
I am the coding horror. Our app was pointing to the API beta server instead of production for a few hours, and it turns out that a change I had made to one of our RightScale scripts ended up applying to literally every server that used it, not just the server I changed it on. I changed a similar script back before making a copy of it to mess around on, but apparently I had missed the other one that caused the problem. I've only been here two months, yet I managed to gently caress things up in that little time. I blame Rightscale more than I blame myself, though. It's loving awful.
|
# ? Apr 30, 2015 14:33 |
|
Pollyanna posted:I am the coding horror. Our app was pointing to the API beta server instead of production for a few hours, and it turns out that a change I had made to one of our RightScale scripts ended up applying to literally every server that used it, not just the server I changed it on. I changed a similar script back before making a copy of it to mess around on, but apparently I had missed the other one that caused the problem. I've only been here two months, yet I managed to gently caress things up in that little time. If you're in development or operations long enough you'll make mistakes. Sometimes those will cause a downtime. If you didn't ever gently caress up, I'd be curious as to whether you were working at all. This thread is littered with the results of learning, in addition to the gross incompetence. The Real Horror is when these people are still making these mistakes after being called out on them. The important thing is learning from it and making changes to prevent it from happening in the future. We're still human, after all. (ask me about soap4r's handling of Content-Type: Chunked on Ruby 2 sometime, or accidentally running a restart command in a shell on prod instead of staging) We try to be careful and operate with diligence and professionalism. That's all you can really do. If you sit there and deny that you did it, or worse, hamstring the folks trying to fix it, then we've got issues. One of the questions we ask our mid-to-senior DBA candidates is "tell us about a production downtime you caused," and the fastest way to get a yellow flag is to immediately defensively respond "I've never caused a downtime." Unless you're Indiana Jones, you haven't navigated Oracle's ridiculous obstacle course of esoteric NIH and bugs unscathed.
|
# ? Apr 30, 2015 16:44 |
|
Storysmith posted:(ask me about soap4r's handling of Content-Type: Chunked on Ruby 2 sometime, or accidentally running a restart command in a shell on prod instead of staging) Some geological ages ago I got in the habit of using ANSI in my prompts to make production hosts be white-on-red, and I'm sure it's saved weeks of downtime in aggregate.
|
# ? Apr 30, 2015 16:55 |
|
IT BEGINS posted:Speaking as someone with no specific investment in your mental health but who enjoys reading code that's worse than my own, you need to stay in your current job for as long as possible.
|
# ? Apr 30, 2015 16:57 |
|
Subjunctive posted:Some geological ages ago I got in the habit of using ANSI in my prompts to make production hosts be white-on-red, and I'm sure it's saved weeks of downtime in aggregate. People still log in by hand to production hosts?
|
# ? Apr 30, 2015 18:04 |
|
Argh, getting tired of the following:
Argh, it's not that hard.
God drat.
|
# ? Apr 30, 2015 18:53 |
|
evensevenone posted:People still log in by hand to production hosts? "Some geological ages ago", but yes, people do.
|
# ? Apr 30, 2015 18:54 |
|
Doctor w-rw-rw- posted:Repeatedly subclassing classes I generalize to tweak one or two things for specific experiences. This is exactly what the open/closed principle says you should do (the open/closed principle is dumb).
|
# ? Apr 30, 2015 19:06 |
|
Subjunctive posted:Some geological ages ago I got in the habit of using ANSI in my prompts to make production hosts be white-on-red, and I'm sure it's saved weeks of downtime in aggregate. This is a very simple and important technique. It saves enough problems that we actually started requiring our customers to configure their terminal emulators this way.
|
# ? Apr 30, 2015 19:23 |
|
Upgrade everyone's terminals to support UTF-8 and designing prompts becomes a whole lot more fun. When I become root, the prompt becomes a hamburger.
|
# ? Apr 30, 2015 19:45 |
|
xzzy posted:Upgrade everyone's terminals to support UTF-8 and designing prompts becomes a whole lot more fun. Not pile of poo? Missed opportunity IMO.
|
# ? Apr 30, 2015 19:57 |
|
Actually we're kind of a horror because we don't make them just change prompts. The background of the entire terminal is red.
|
# ? Apr 30, 2015 22:33 |
|
Apparently, my supervisor forgot that sqlite is single-user.
|
# ? Apr 30, 2015 22:42 |
|
IT BEGINS posted:our 'CTO' is the owner and there's a ton of push-back to getting this stuff fixed. Also a lot of this stuff was written by his son so yaaaaaaay. hahahaha it all makes sense now.
|
# ? Apr 30, 2015 23:58 |
|
megalodong posted:hahahaha it all makes sense now. No loving way. How long is the company gonna last at this rate? A week?
|
# ? May 1, 2015 00:04 |
|
Pollyanna posted:No loving way. How long is the company gonna last at this rate? A week? It's been around for over 15 years at this point, so as insane as that poo poo is I don't think it's going to suddenly go belly-up.
|
# ? May 1, 2015 00:09 |
|
LeftistMuslimObama posted:Actually we're kind of a horror because we don't make them just change prompts. The background of the entire terminal is red. That's the right thing, if you can reliably control the configuration of the terminal program.
|
# ? May 1, 2015 00:16 |
|
Subjunctive posted:That's the right thing, if you can reliably control the configuration of the terminal program. If you can change the terminal to match the Mega Man X intro I'll totally work there.
|
# ? May 1, 2015 00:27 |
|
Subjunctive posted:That's the right thing, if you can reliably control the configuration of the terminal program. Yeah, we make everyone buy Attachmate Reflection so that we have a consistent api through which to of terminal programming.
|
# ? May 1, 2015 01:08 |
|
|
# ? Jun 7, 2024 09:17 |
|
Returning false from my script is success you say? Throw an exception you say?code:
|
# ? May 1, 2015 04:01 |