|
Finster Dexter posted:terrible_programmer.txt Sometimes I write something clever that's good but then I realise it's a clever solution to a problem caused by our insane legacy codebase.
|
# ? Mar 26, 2019 18:42 |
|
|
# ? Apr 25, 2024 21:32 |
|
my_entire_last_year_at_experts_exchange.txt
|
# ? Mar 26, 2019 18:47 |
|
|
# ? Mar 26, 2019 18:47 |
|
if i have a python object that needs to touch the database should it have its own connection or be passed one? neither one feels like it makes more sense
|
# ? Mar 26, 2019 18:51 |
Corla Plankun posted:if i have a python object that needs to touch the database should it have its own connection or be passed one? neither one feels like it makes more sense pass i say, so you decouple connectivity from logic
|
|
# ? Mar 26, 2019 19:29 |
|
just kiss it goodbye and send it out on the enterprise bus
|
# ? Mar 26, 2019 19:30 |
|
cinci zoo sniper posted:pass i say, so you decouple connectivity from logic Yeah, makes it easier to test
|
# ? Mar 26, 2019 19:41 |
|
cinci zoo sniper posted:pass i say, so you decouple connectivity from logic
|
# ? Mar 26, 2019 19:42 |
|
cinci zoo sniper posted:pass i say, so you decouple connectivity from logic
|
# ? Mar 26, 2019 20:54 |
|
cinci zoo sniper posted:pass i say, so you decouple connectivity from logic Congrats you're a DI expert now
|
# ? Mar 26, 2019 21:42 |
Janitor Prime posted:Congrats you're a DI expert now DI?
|
|
# ? Mar 26, 2019 22:15 |
|
dependency injection
|
# ? Mar 26, 2019 22:25 |
|
Death Imitation
|
# ? Mar 26, 2019 22:28 |
|
Janitor Prime posted:Congrats you're a DI expert now precisely
|
# ? Mar 26, 2019 22:29 |
|
|
# ? Mar 26, 2019 23:06 |
|
cinci zoo sniper posted:pass i say, so you decouple connectivity from logic also if you don’t you’re gonna be asked to migrate database vendors next month and then you’re gonna be sorry you didn’t of course if you do, you’ll never migrate vendors so...
|
# ? Mar 26, 2019 23:20 |
|
ctps:code:
|
# ? Mar 27, 2019 00:31 |
|
who says inheritance is a bad idea
|
# ? Mar 27, 2019 02:52 |
|
Soricidus posted:ctps: Using this in production code just for kicks.
|
# ? Mar 27, 2019 04:22 |
|
lol
|
# ? Mar 27, 2019 07:01 |
|
Soricidus posted:ctps:
|
# ? Mar 27, 2019 07:50 |
|
Soricidus posted:ctps:
|
# ? Mar 27, 2019 19:14 |
|
I was about to register my business with the city clerk when I read that I need a Home Occupation License with permission from my apartment manager, and I'm staying with my parents in a retirement home so I can't get that. I guess I'll get a "real job", save up some money, try again in a year, and hope the #3 competitor ScrapeHero in this type of business hasn't pulled too far ahead of me by then. The website is www.locatr.tk if anyone wants to take a look at what I've done so far
|
# ? Mar 27, 2019 19:50 |
|
just register in delaware or nevada or belize or something
|
# ? Mar 27, 2019 20:00 |
|
galenanorth posted:locatr omg.
|
# ? Mar 27, 2019 20:11 |
|
galenanorth posted:I was about to register my business with the city clerk when I read that I need a Home Occupation License with permission from my apartment manager, and I'm staying with my parents in a retirement home so I can't get that. I guess I'll get a "real job", save up some money, try again in a year, and hope the #3 competitor ScrapeHero in this type of business hasn't pulled too far ahead of me by then. The website is www.locatr.tk if anyone wants to take a look at what I've done so far Not an .io domain, smdh
|
# ? Mar 27, 2019 20:13 |
gonadic io posted:Not an .io domain, smdh not even loca.tr
|
|
# ? Mar 27, 2019 20:27 |
|
Soricidus posted:ctps: Dijkstracula posted:who says inheritance is a bad idea One time we were writing Python to interact with a HTTP API which, contrary to the spec, treated HTTP request header names case-sensitively. Something like, "USER_KEY: blah" would work, but "user_key: blah" would not. Unfortunately, Python's HTTP library helpfully flattens the case of headers before sending, so we would do something like set_header("USER_KEY", "blah") and it would get sent as "user_key: blah", so it was essentially impossible to get the API to work from Python. (Or to get the fools in charge of the API to fix it.) In the end what we ended up doing was subclassing Python's string class and overriding the .lowercase() method so it didn't do anything, it just returned the unmodified string. set_header(CustomStringClass("USER_KEY"), "blah") worked.
|
# ? Mar 27, 2019 20:37 |
|
thats amazing
|
# ? Mar 27, 2019 20:46 |
|
obv the API devs are like "gently caress we can't make it case-insensitive or we break our clients that rely on being able to support HTTP_POOP and http_poop as different values"
|
# ? Mar 27, 2019 20:48 |
|
I agree with your implicit point that's always wise to assume good faith. People do the best work they can and are often dealing with other requirements which you can't see. But, no, they were just hopelessly bad at their jobs and I don't think they could have fixed their own code if they tried. Another part of this same API had an issue where every now and then requests would stop returning content. Still 200 OK and the right XML wrapper, just the requested resource which was supposed to be inside that XML was missing. After we brought this up with them, they told us that, yes, this starts happening from time to time, and if it happens, we should contact them so they can restart the server.
|
# ? Mar 27, 2019 21:02 |
|
code:
|
# ? Mar 27, 2019 22:02 |
|
lmao
|
# ? Mar 27, 2019 22:34 |
|
such power,,
|
# ? Mar 27, 2019 23:18 |
|
holy poo poo this code is so bad. i literally cut the runtime in half by just moving an expensive deserialization of a value that never actually changed out of an inner loop. i'm not even going to do the "what idiot wrote this" joke because the punchline is just too obvious signed, the worst programmer
|
# ? Mar 28, 2019 01:17 |
|
Its not just peeps learning, its their sleep and caffeine deprivation state and selfconsciousness when writing. So it's never monotonic, how much your code gets better
|
# ? Mar 28, 2019 01:27 |
|
oh hey this bit's taking *scribbles on back of envelope* quadratic time when there's an obvious logarithmic time algorithm. it also inexplicably uses global variables to pass state into parameterless functions I didn't write this part, i'm bad but goddamn there are limits
|
# ? Mar 28, 2019 02:04 |
|
"hmm, I need to store a mapping in which the keys are guaranteed always to be the integers from 0 to n, and I will always want to insert and access the values in that order too. I know, I’ll use a hash table" — the fucker who wrote the code my profiler identified as the next bottleneck
|
# ? Mar 28, 2019 02:12 |
|
lol fixing those two things literally cuts the runtime in half again on typical inputs. well that was a productive hour
|
# ? Mar 28, 2019 02:13 |
|
|
# ? Apr 25, 2024 21:32 |
|
Krankenstyle posted:what the gently caress, latex? new front page column?
|
# ? Mar 28, 2019 03:46 |