|
Cancelbot posted:I completely agree. There's just years of institutional crap I need to clean up where people just hop onto production SQL for "quick fixes". Thinking about this and the strategy of putting data-access logic in stored procedures so it can be changed without doing a new deploy of the code made me decide what my counter will be, the next time somebody advocates that strategy at me: "What's wrong with our deploy process that makes us so reluctant to go through it? And what can we do to fix that?" Part of my motivation here is that I just added some fallback behavior for the code that handles the application configuration, which I was instructed to update to match what the team currently wants to do: store the configuration in a shared location, instead of in App.config. A noble effort! Get all those connection strings and server names into one place, so we can change them all at once. What's the central location, you ask? A database, of course! Where does the connection string for that database go? In App.config, duh! Nailed it.
|
# ? Dec 4, 2017 23:50 |
|
|
# ? May 9, 2024 22:27 |
|
Clanpot Shake posted:Doing my first ever production deploy tonight which entails changing the primary and foreign keys on ~100 million rows and changing the application services to use the new thing. Fingers crossed. What happens if it stops at 43% changed? Asking for a friend.
|
# ? Dec 5, 2017 00:41 |
|
Virigoth posted:What happens if it stops at 43% changed? Asking for a friend. We restore the database to the backup we took before we started.
|
# ? Dec 5, 2017 00:46 |
|
I hope you test that backup
|
# ? Dec 5, 2017 00:52 |
|
When do you guys feel that method chaining gets excessive? Like the following is fine code:
code:
code:
|
# ? Dec 5, 2017 01:19 |
|
Clanpot Shake posted:We restore the database to the backup we took before we started. Edit nvm.
|
# ? Dec 5, 2017 01:22 |
|
Ither posted:
Each of those chained methods should return a unique error if it fails. If that's the case I see no problem with chaining.
|
# ? Dec 5, 2017 01:33 |
|
Knowing Java, they're all going to be NullPointerExceptions!
|
# ? Dec 5, 2017 01:41 |
|
The Fool posted:I hope you test that backup I bet it’s the cloud, so it’s probably fine.
|
# ? Dec 5, 2017 01:46 |
|
Punkbob posted:I bet it’s the cloud, so it’s probably fine. It's okay, it is the cloud.
|
# ? Dec 5, 2017 01:50 |
|
CPColin posted:Knowing Java, they're all going to be NullPointerExceptions! The excellent developers at Reuters do this, or an exception with the error code embedded somewhere in a text string of dubious usefulness. Frequently the errors are reported asynchronously in a log file and the execution path silently craps out
|
# ? Dec 5, 2017 01:52 |
|
Clanpot Shake posted:It's okay, it is the cloud. Since you said this is your first prod deploy here are some things to think about : Is your Ops guy going to be on the call with you during the work window if it goes sideways? It'd be good to get your infra/ops side of the house involved if you can. Do you have a backup DB up and running that you can fail back to and keep your outage window smaller so you don't gently caress up your SLA and have a smaller mean time to repair if it does go pear shaped? Double check your commands you have pre-typed out for the change you copied from your test run (you do have them all prepped right?) for typos and duplicates. You don't want to be like the AWS S3 guy who had a typo and took down half the internet. Have your form of drug/booze nearby for when it's complete so you can celebrate accordingly.
|
# ? Dec 5, 2017 01:55 |
|
Virigoth posted:Since you said this is your first prod deploy here are some things to think about : I'm actually not flying solo on this, which is nice, I just authored all of it. We've tested the migration and restore repeatedly in lower environments so I'm pretty confident it will work either way. It's also nothing nearly important as S3 as our site only really needs to be up during continental US hours. But yes I have everything written in a text file.
|
# ? Dec 5, 2017 02:02 |
|
MrMoo posted:The excellent developers at Reuters do this, or an exception with the error code embedded somewhere in a text string of dubious usefulness. Frequently the errors are reported asynchronously in a log file and the execution path silently craps out My company's product uses this classic pattern: 1) Every function implementation is wrapped in a top-level try-catch 2) Every problem, error, and non-success state throws an exception 3) The catch block from (1) logs the error to a single giant database table 4) The catch block re-throws the exception (or throws a brand new, different exception, and no there's no rules for this) I hate this to an irrational degree, I think. I'm not a fan of using exceptions for non-exceptional behavior. I know this is debatable, but my view of an exception is that it should be use for exceptional circumstances. A user entering a special character that the system can't handle, a request timeout, things like that. "Invalid password" is not exception-worthy in my book. The real problem in this code is probably the fact that very often, an error will get transformed so much by the time it reaches somebody's eyes that it's likely to be misleading or outright incorrect. When your errors are exceptions that get re-thrown, every catch block up the chain is an opportunity to lose data. Typing this out, maybe it's not a bad pattern in and of itself. Maybe the problem is just that our code is the wild west and there's no consistency or guidelines on how to user or handle exceptions. Anybody agree or disagree with any of this? Che Delilas fucked around with this message at 02:54 on Dec 5, 2017 |
# ? Dec 5, 2017 02:31 |
|
Virigoth posted:What happens if it stops at 43% changed? Asking for a friend. you type "rollback" instead of "commit"
|
# ? Dec 5, 2017 02:51 |
|
DELETE CASCADE posted:you type "rollback" instead of "commit" We're running everything outside of a transaction because the overhead of a transaction makes it too slow.
|
# ? Dec 5, 2017 03:56 |
|
CPColin posted:Knowing Java, they're all going to be NullPointerExceptions! I had to think about that for a minute because some languages are a bit better about chains like that than others. I think Python would tell you it couldn't find the getFizz() method for NoneType, which would take you right to getBuzz() returning null. I wanted to think C# did something similar but I think I was crossing the signals in my head there.
|
# ? Dec 5, 2017 06:43 |
|
Objective C and some others just don't execute function calls on nil objects, which I found to be one nice aspect of the language. So, foo.getFoo().getBar().getBaz().doThing() will just do nothing past getBar if getBar returns nil.
|
# ? Dec 5, 2017 06:54 |
|
Volmarias posted:Objective C and some others just don't execute function calls on nil objects, which I found to be one nice aspect of the language. So, foo.getFoo().getBar().getBaz().doThing() will just do nothing past getBar if getBar returns nil. Seems like that trades one problem for another. Instead of ambiguous pants-making GBS threads on that line of code, you get ambiguous pants-making GBS threads later based on the assumption a thing was done that wasn't.
|
# ? Dec 5, 2017 08:16 |
|
Rocko Bonaparte posted:Seems like that trades one problem for another. Instead of ambiguous pants-making GBS threads on that line of code, you get ambiguous pants-making GBS threads later based on the assumption a thing was done that wasn't. At least it won’t surface those pants to the user though. Modern C# has the ?. operator which does basically the same thing. It’s good, and hopefully soon I’ll be able to use it.
|
# ? Dec 5, 2017 11:06 |
|
Ither posted:When do you guys feel that method chaining gets excessive? Law of Demeter. Does foo.getStudent() or at least foo.getFizz() make any logical sense? If so, add the chain behind it.
|
# ? Dec 5, 2017 11:22 |
CPColin posted:Knowing Java, they're all going to be NullPointerExceptions! Methods chained that far trigger me because there is no way in hell one of those isn't going to be null on purpose at some point. Plus that's not meeting the java standard for verbosity, it should be more like code:
|
|
# ? Dec 5, 2017 13:18 |
|
Ither posted:When do you guys feel that method chaining gets excessive? It is and in bad hibernate setups - of which there are many - it’s mapped object hell just like this. When we finally moved to gradle, we started getting a handful of NPEs right in the middle of a chain that never showed up before. Instead of fixing the 20 or so odd places, it was decided that we just wouldn’t move that app to gradle.
|
# ? Dec 5, 2017 15:19 |
|
geeves posted:It is and in bad hibernate setups - of which there are many - it’s mapped object hell just like this. Wtf? Was there some combo of dependency hell that did this to non pinned versions? Or what?
|
# ? Dec 5, 2017 15:20 |
|
I look forward to the next time I newly encounter a Java codebase and get to start all over again with adding @NonNull and @Nullable everywhere!
|
# ? Dec 5, 2017 16:08 |
|
All you people whining about Java need to jump on the kotlin train
|
# ? Dec 5, 2017 16:24 |
|
Rule of thumb: avoid programming languages that brag on their home page about not needing semicolons.
|
# ? Dec 5, 2017 16:29 |
|
CPColin posted:Rule of thumb: avoid programming languages that brag on their home page about not needing semicolons.
|
# ? Dec 5, 2017 16:59 |
|
You guys ever do that thing where you spend hours coming up with an extremely efficient algorithm for your data structure, only to learn that you’ll never have more than a couple dozen pieces of data, and the ugliest algorithm in the world would execute in approximately the same time? That happens to me a lot.
|
# ? Dec 5, 2017 20:36 |
|
Some habits that can help protect against that:
|
# ? Dec 5, 2017 20:40 |
|
Yeah always write the shittier version first if that can be done cleaner. You can use it as a testbench against the optimized version.
Rocko Bonaparte fucked around with this message at 22:15 on Dec 5, 2017 |
# ? Dec 5, 2017 20:54 |
I was told to, as a rule, never pre-optimize. Especially in my line of work (fintech lol ) the payoff is rarely worth the effort. That doesn't always stop me though sometimes it's super nice to spend 45 mins thinking and come up with an O(n) solution to someone else's triple nested loop
|
|
# ? Dec 5, 2017 21:14 |
|
Why would you ever rob yourself of the opportunity to write total garbage the first time and then come back and say "look how much I improved this bad legacy code"
|
# ? Dec 5, 2017 21:19 |
|
I spent so long in college learning about time v space trade-offs in programming, but software development is all about development speed v correctness of new features. This little fact is something that didn’t really sink in until just recently when I read the Google SRE book. Do other professions have this weird chasm between school and work? Is this like how lawyers (according to My Cousin Vinny) learn theory in school, and expect their firms to train them in practice?
|
# ? Dec 5, 2017 21:49 |
|
lifg posted:I spent so long in college learning about time v space trade-offs in programming, but software development is all about development speed v correctness of new features. This little fact is something that didn’t really sink in until just recently when I read the Google SRE book. Medicine? Especially if you’re an NP.
|
# ? Dec 5, 2017 22:14 |
|
lifg posted:I spent so long in college learning about time v space trade-offs in programming, but software development is all about development speed v correctness of new features. This little fact is something that didn’t really sink in until just recently when I read the Google SRE book.
|
# ? Dec 5, 2017 22:24 |
|
lifg posted:Do other professions have this weird chasm between school and work? Is this like how lawyers (according to My Cousin Vinny) learn theory in school, and expect their firms to train them in practice? I have a BFA in graphic design and it varies a lot from school to school but yeah classes were very much theory based with the expectation that internships and entry junior designer roles would fill out the practical side of things
|
# ? Dec 6, 2017 01:03 |
|
lifg posted:I spent so long in college learning about time v space trade-offs in programming, but software development is all about development speed v correctness of new features. This little fact is something that didn’t really sink in until just recently when I read the Google SRE book. Yes. Think particularly historical (Pre-1990) white collar jobs. You get your degree from school to show you can learn poo poo and then you get trained by the company you spend the next 40 years working for. The fact that you have a degree in Anthropology is meaningless to be a manager of widget makers.
|
# ? Dec 6, 2017 01:14 |
|
Hughlander posted:Wtf? Was there some combo of dependency hell that did this to non pinned versions? Or what? That’s what I track down when I have time or have to when we have to upgrade struts. Just discovered that struts2-convention has been included that conflicts a lot with asm. I don’t know how I’ve missed it before but we don’t use it at all yet it’s been in our code for years. so I’m hoping this takes care of this issue that decided to show up when we switched from maven to gradle over the last week. I should know tomorrow morning
|
# ? Dec 6, 2017 03:02 |
|
|
# ? May 9, 2024 22:27 |
|
^^^^ Didn't meant to DP, but yep a dependency conflict that only appears with certain java versions and tomcat 8 was asm and struts. The aha moment was working on something different and updating from struts 2.3.34 to 2.5.14 in the coming weeks - catalina.out basically exploded on start up which made it much easier to track down. Taffer posted:All you people whining about Java need to jump on the kotlin train Our new API is written in Kotlin geeves fucked around with this message at 16:05 on Dec 6, 2017 |
# ? Dec 6, 2017 16:02 |