|
Powerful Two-Hander posted:static dll cursed terminology
|
# ? Aug 11, 2022 23:49 |
|
|
# ? May 7, 2024 01:38 |
|
Share Bear posted:cursed terminology call it static, call it vendoring, who cares? Just dehumanise and face package managers and walk backwards into Shaggar's embrace
|
# ? Aug 11, 2022 23:53 |
|
Look deep down inside yourself and ask "do I give a gently caress?" No? then do whatever is easiest for you at the time and be at peace. Future you can get angry and post back in this thread at any time.
|
# ? Aug 11, 2022 23:57 |
|
Sapozhnik posted:this seems like a great idea right up until the first moment when you need to make an arbitrarily sortable and searchable table in your application i use that pattern and unironically donīt see any problem with it tbh other perhaps than that the condition should be written as "(:what is null or :what = what)" to make it easier for the engine to short-circuit missing parameters, but i expect that modern dbs can figure it out either way
|
# ? Aug 11, 2022 23:59 |
|
NihilCredo posted:i use that pattern and unironically donīt see any problem with it tbh Query planners choose and reuse an execution plan based on the prepared statement alone, not the particular invocation. Even if you have an index on one of the columns, and happen to only use that column for a query, it will probably choose a full table scan.
|
# ? Aug 12, 2022 00:38 |
|
imo this is unironically the time to build the SQL statement in the caller to avoid having a proc with 20 parameters that will almost certainly create a hosed up plan
|
# ? Aug 12, 2022 00:55 |
|
assuming your tables are properly indexed, a proc with optional parameters is basically the example of when to use OPTION(RECOMPILE)
|
# ? Aug 12, 2022 02:25 |
|
fyi for those using databases other than mssql, which for this thread i assume is most of you: normally with stored procedures, the query planner caches the plan from the first call and reuses it for subsequent calls. if you don't want this, for reasons such as those posted above, you can always use dynamic sql in the proc. or if you're using mssql, you can write option(recompile), which is a stupid name because recompilation is not the important step, it's re-planning, but when was microsoft ever known for giving anything a good name?
|
# ? Aug 12, 2022 04:17 |
|
im a page late but just wanted to say that tinkerpop gremlin is the funnest name for a technology i;ve encountered irl but thats literally the only thing i remember about using it so idk if it is any good for anything
|
# ? Aug 12, 2022 04:26 |
|
DELETE CASCADE posted:fyi for those using databases other than mssql, which for this thread i assume is most of you: normally with stored procedures, the query planner caches the plan from the first call and reuses it for subsequent calls. if you don't want this, for reasons such as those posted above, you can always use dynamic sql in the proc. or if you're using mssql, you can write option(recompile), which is a stupid name because recompilation is not the important step, it's re-planning, but when was microsoft ever known for giving anything a good name? its recompiling the proc/plan
|
# ? Aug 12, 2022 04:32 |
|
didn't mysql use to not cache prepared statement plans and just recompile every single time? hell, maybe it still does. i'm sad i haven't done any db stuff in like 10 years, but the silver lining is that it's also guaranteed i'd never have to touch mysql during that time so maybe it's not so bad
|
# ? Aug 12, 2022 05:51 |
|
the crown of shittiest dbms used for depressingly serious data has been definitively passed on from mysql, mind you
|
# ? Aug 12, 2022 05:56 |
|
NihilCredo posted:i use that pattern and unironically donīt see any problem with it tbh what is null baby don't hurt me don't hurt me no more
|
# ? Aug 12, 2022 06:21 |
|
DELETE CASCADE posted:fyi for those using databases other than mssql, which for this thread i assume is most of you: normally with stored procedures, the query planner caches the plan from the first call and reuses it for subsequent calls. if you don't want this, for reasons such as those posted above, you can always use dynamic sql in the proc. or if you're using mssql, you can write option(recompile), which is a stupid name because recompilation is not the important step, it's re-planning, but when was microsoft ever known for giving anything a good name? buddy, this is the lovely programming thread. naming things is hard.
|
# ? Aug 12, 2022 06:24 |
|
yeah i'm bad at it too
|
# ? Aug 12, 2022 06:29 |
|
DELETE CASCADE posted:yeah i'm bad at it too
|
# ? Aug 12, 2022 06:30 |
|
naming things is so hard that 'naming things' is not even a good name for the act. so 'naming things is hard' is a fully recursive statement in and of itself see h wayne's thingy about it https://buttondown.email/hillelwayne/archive/naming-things-is-a-poor-name-for-naming-things/
|
# ? Aug 12, 2022 06:32 |
|
every time i want to call it the thing-doer i briefly think to myself, "hmm, perhaps marketing is not complete bullshit after all?", but then the moment passes and i remember how useless they are at naming things too
|
# ? Aug 12, 2022 06:32 |
|
they renamed 'rapeseed oil' 'canola oil'. that was a worthwhile act
|
# ? Aug 12, 2022 06:34 |
|
im pretty good at naming things
|
# ? Aug 12, 2022 06:44 |
|
bob dobbs is dead posted:they renamed 'rapeseed oil' 'canola oil'. that was a worthwhile act it's just another example of americans being proud for being italians and ashamed of being german
|
# ? Aug 12, 2022 07:38 |
|
I always saw hot dogs as german cuisine's influence on america and now hot dogs are considered as much of a part of americana as baseball and apple pie https://www.cnn.com/travel/article/hot-dog-classic-american-summer-food/index.html
|
# ? Aug 12, 2022 08:47 |
|
using node.js is just a constant stream of disappointment. so many libraries and frameworks look ok but are just missing important bits of functionality or have hosed up models
|
# ? Aug 12, 2022 09:05 |
|
distortion park posted:using node.js is just a constant stream of disappointment. so many libraries and frameworks look ok but are just missing important bits of functionality or have hosed up models
|
# ? Aug 12, 2022 09:43 |
|
Plank Walker posted:maybe, I think string literal unions are what I want/need. the use case is I generally want them to be serialized as strings to they can be passed to some backend APIs where the input is a string, but not any old string, just one option out of a handful, or vice versa with an API that returns a string value from a known set of strings we use something like code:
the typeof Thing[keyof typeof Thing] is annoying so we have a utility type type ValueOf<T> = T[keyof T] and use it like ValueOf<typeof ButtStatus> is it better than ts enums or string literal union types? nah. is it basically the same as an enum but a bit more awkward to define? a little, yes i get the feeling the ts lang team regret creating enums because there isn't (yet?) have a corresponding js equivalent. and the docs have some warnings about using enums with modules that i'm not js-brained enough to understand so i avoid them MrQueasy posted:Enums work well for that too if you want to hang more information than just a value (like schema defs, etc) off the string. yo, what do you mean by this?
|
# ? Aug 12, 2022 10:36 |
|
Deffon posted:Query planners choose and reuse an execution plan based on the prepared statement alone, not the particular invocation. Even if you have an index on one of the columns, and happen to only use that column for a query, it will probably choose a full table scan. imo either all the columns are indexed, or none are if for some reason only some of the columns are indexed, i would have two search functions, a regular 'search' for indexed columns only and a 'slow_search' for any column application developers shouldn't be expected to have to look at indexes to figure out which functions to call, so if the perf characteristics are drastically different based on parameters i would make it clear in the api also for postgres, the equivalent of option(recompile) is `set plan_cache_mode = force_custom_plan`. there's a ton of other options you can set as well: https://www.postgresql.org/docs/14/runtime-config-query.html
|
# ? Aug 12, 2022 11:01 |
|
DELETE CASCADE posted:every time i want to call it the thing-doer i briefly think to myself, "hmm, perhaps marketing is not complete bullshit after all?", but then the moment passes and i remember how useless they are at naming things too i've used more synonyms for "worker" in code than a mid-20th century leftist party schism
|
# ? Aug 12, 2022 11:04 |
|
NihilCredo posted:i've used more synonyms for "worker" in code than a mid-20th century leftist party schism lol
|
# ? Aug 12, 2022 15:34 |
|
Web comrades and comrade threads
|
# ? Aug 12, 2022 16:54 |
|
class Traitor extends Worker implements Supervisor
|
# ? Aug 12, 2022 17:03 |
|
code:
|
# ? Aug 12, 2022 17:26 |
|
matti posted:im pretty good at naming things imo naming things isn't hard at all if you spend like 20 minutes thinking about stakeholders but in my experience most developers consider this act to be below them
|
# ? Aug 12, 2022 17:42 |
|
All the developers snicker as the boss laments, "I don't get it. I've been eating all this celery but our Concurrent User Metric hasn't increased at all!"
|
# ? Aug 12, 2022 17:52 |
|
redleader posted:yo, what do you mean by this? Whoops, I misremembered how un-powerful Typescript's enums are compared to Java/Python. I forgot that typescript doesn't let you create things like code:
|
# ? Aug 12, 2022 18:54 |
|
right but instead of using actual enums you'd want to use discriminated unions instead. type SomeEnum = ("shid" | "fard") & { doSomethingFancy() }; is a valid type in typescript
|
# ? Aug 12, 2022 18:59 |
|
"hey we think that this queue needs to have our new hosts added to an allow list so we can publish, can you tell us how we do that?" "well it depends, did you add the hosts to the allow list first?" don't gently caress with me middleware
|
# ? Aug 12, 2022 19:01 |
|
Sapozhnik posted:right but instead of using actual enums you'd want to use discriminated unions instead. Yes, but how do you use it? (This is the type of awful cleverness I love)
|
# ? Aug 12, 2022 19:08 |
|
use it to do what? you're the one who produced the original example
|
# ? Aug 12, 2022 19:21 |
|
I mean... in java I can do something like...code:
code:
code:
|
# ? Aug 12, 2022 19:34 |
|
|
# ? May 7, 2024 01:38 |
|
type SomeEnum = ("shid" | "fard") & { something(): string }; function one(): SomeEnum { const x = "shid"; x.something = () => "asdf"; return x; } function two(): SomeEnum { const x = "fard"; x.something = () => "fdsa"; return x; } why you'd want to do this is a whole other question but javascript is terrible, strings are objects, and you can add properties and indeed delete properties on any individual object you please.
|
# ? Aug 12, 2022 19:54 |