|
Bloody posted:okay now back to git subtrees please So what was wrong with submodules?
|
# ? May 19, 2021 05:37 |
|
|
# ? Apr 29, 2024 16:36 |
|
when i tried to use git subtrees it was more of a pain than just using submodules- so i just hid that it was submodules from people with a good makefile/whatever tooling
|
# ? May 19, 2021 05:41 |
|
imo git submodules are a known quantity of weird and the alternatives are worse
|
# ? May 19, 2021 05:42 |
|
comedy option just keep all your deps in the same repo as different refs https://git-scm.com/docs/git-worktree
|
# ? May 19, 2021 05:46 |
|
make way for git subtrac https://github.com/apenwarr/git-subtrac
|
# ? May 19, 2021 06:28 |
|
I sleep in a big monorepo with my wife
|
# ? May 19, 2021 07:19 |
|
is there any forking involved?
|
# ? May 19, 2021 07:23 |
|
Programmers really need to stop abbreviating random words in unconventional ambigous ways. Like, leg_hands is harder to read than legend_handles anyway, just leave it the gently caress alone, goddamnit!
|
# ? May 19, 2021 07:35 |
|
Ocean of Milk posted:Programmers really need to stop abbreviating random words in unconventional ambigous ways. Like, leg_hands is harder to read than legend_handles anyway, just leave it the gently caress alone, goddamnit!
|
# ? May 19, 2021 08:06 |
|
Ocean of Milk posted:Programmers really need to stop abbreviating random words in unconventional ambigous ways. Like, leg_hands is harder to read than legend_handles anyway, just leave it the gently caress alone, goddamnit! only the first 6 chars of a variable matter to my compiler from 1980 so now you all must suffer
|
# ? May 19, 2021 10:32 |
|
even programmers who use actual dictionary word variable names will still cargo cult generics w/ single letters
|
# ? May 19, 2021 10:41 |
|
N.Z.'s Champion posted:even programmers who use actual dictionary word variable names will still cargo cult generics w/ single letters you can write List<TheTypeOfThingThatIsInTheList> if you like but everyone else is capable of learning what T means
|
# ? May 19, 2021 11:11 |
|
Soricidus posted:you can write List<TheTypeOfThingThatIsInTheList> if you like but everyone else is capable of learning what T means I actually hate using T or whatever for this it's unnecessarily unclear imho method names is my other main hate though. like GetTheNameOfTheThingByTheIdOfTheThing(int id) or similar. just give it a shorter name like GetThingName and put a summary block on it ffs
|
# ? May 19, 2021 11:26 |
|
imo when it's one type parameter like "this is the thing the collection contains" then it's fine if there's two like a map from keys to values then it could go either way really, K,V is pretty clear but KeyType,ValueType wouldn't be too bad either if you have more than that like AbstractOrganizerStrategy<T,U,V,W> then gently caress right off, give them proper names or get out of my codebase
|
# ? May 19, 2021 11:51 |
|
Powerful Two-Hander posted:I actually hate using T or whatever for this it's unnecessarily unclear imho here's a bike for y'all to shed: assume your language supports method overloading and dynamic dispatch. which of these two styles do you go with: 1) code:
code:
|
# ? May 19, 2021 12:03 |
|
Soricidus posted:you can write List<TheTypeOfThingThatIsInTheList> if you like but everyone else is capable of learning what T means
|
# ? May 19, 2021 12:08 |
|
NihilCredo posted:here's a bike for y'all to shed: the second thing and i hope to god the first thing doesn't actually compile because the return types are different. if the return types are the same, the first thing probably. unless one of these methods has wildly different efficiency or runtime costs than the others in which case back to the second thing. i'd only use overloads if it's fully a convenience thing and the different argument forms are like a oneliner pointer chase away from each other.
|
# ? May 19, 2021 12:13 |
|
First thing when I'm calling it and I know it's just gonna work when I feed it whatever because it's been written by someone much smarter than me. Second thing when I have to actually look at the class in the IDE to understand what it does, let alone change it. code:
Things like getThing(directReferenceHolder: OtherThingThatHoldsIndirectReferenceToAThing) shouldn't exist, just do getThing(directReference: ActualMeaningFulReference), cause IDEs are smart enough to suggest getThing(thingWithIndirectReference.getActualMeaningfulReference()) to you. Pseudo-edit: quote:
I had to look at this thing in the second List to even notice what the idea was (by best match).
|
# ? May 19, 2021 13:28 |
|
Option 2 generally from a maintenance perspective, especially when you have a well-formed naming schema, ie "getThingBy[concept]", but otherwise try to keep the method names terse to make it not terribly obnoxious to use. getThingById getThingByClass getThingByName getThingBySearch Don't put "try" in the names, since exception handling should be delegated to the caller. If your code expects a return and the specific get method doesn't have something, that's an exception. Make sure the get methods throw a specialized typed exception so callers can handle it appropriately. Regarding abbreviation talk, we have a fairly active policy against them in any form. Find another way to make your variables terse that doesn't involve arbitrarily shaving out letters that are critical for context. Sometimes names need to be long for clarity. That's what IDEs and autocomplete are for. "legend_handle" is completely within reason imo. Thank you for coming to my ted talk.
|
# ? May 19, 2021 13:58 |
|
Phobeste posted:the second thing and i hope to god the first thing doesn't actually compile because the return types are different. if the return types are the same, the first thing probably. unless one of these methods has wildly different efficiency or runtime costs than the others in which case back to the second thing. i'd only use overloads if it's fully a convenience thing and the different argument forms are like a oneliner pointer chase away from each other. lol why wouldn't the first compile?
|
# ? May 19, 2021 14:07 |
|
I don't like the "try" bit either because whenever I've seen it it's been abused to mean "I don't know what I'm actually calling inside this and sometimes it fails and idk why so I'll call it 'try... ' and make the return type nullable", but that's because I see a lot of terrible code (and write it as well)
|
# ? May 19, 2021 14:08 |
|
N.Z.'s Champion posted:even programmers who use actual dictionary word variable names will still cargo cult generics w/ single letters It's called math honey
|
# ? May 19, 2021 14:08 |
|
the first is correct. no need to repeat the type of the parameters in the method name, unless you're working in some hellscape like js or python where that isn't immediately obvious to the developer
|
# ? May 19, 2021 14:08 |
|
trygetthing is useful when set presence and value are both being determined at once, like in a dictionary. being given a return value alone is not sufficient without also signaling success in some manner, either by wrapping the T of the dictionary in a Result or by returning a (bool, T) by some means
|
# ? May 19, 2021 14:11 |
|
Shaggar posted:here's a bike for y'all to shred:
|
# ? May 19, 2021 14:14 |
|
Bloody posted:lol why wouldn't the first compile? oh i guess it does yeah. it's kind of gross to me to do that though imo optionals shouldn't be covariant with concrete results
|
# ? May 19, 2021 14:17 |
|
yeah there's an issue there for sure. seems unlikely that get thing is gonna return a thing for every possible uuid but not every possible string
|
# ? May 19, 2021 14:24 |
|
xtal posted:It's called math honey If this is any indication, mathematicians also write at least a few lines of prose (often an entire paragraph) for every line of equations.
|
# ? May 19, 2021 14:29 |
|
Phobeste posted:oh i guess it does yeah. it's kind of gross to me to do that though imo optionals shouldn't be covariant with concrete results the return type is irrelevant, they could return the same type or four completely different types and it wouldn't matter the reason it compiles is because the _parameter_ types are unambiguously distinct (uuid, string, class, string list), so the parametric polymorphism can be statically checked
|
# ? May 19, 2021 14:35 |
|
i only like try in a method name when it’s a tryget pattern like bool TryGetGoodPosts(int userId, out string[] goodPosts). of course that example would always return false
|
# ? May 19, 2021 14:44 |
|
NihilCredo posted:the return type is irrelevant, they could return the same type or four completely different types and it wouldn't matter i get that i'm saying it shouldn't work that way because it's gross to have the kind of the return vary. the return varying by type (e.g. float -> float and int -> int) is fine but it's gross, to me, that you can have int -> int and float -> float?.
|
# ? May 19, 2021 14:46 |
|
it's fine, op capitalizing method names, however, is a crime against humanity
|
# ? May 19, 2021 14:52 |
|
Yeah there's this notion in some OOP texts/systems that methods with different parameters but the same name are somehow "the same", which is bizarre to anyone used to method overloading in statically typed systems. The term "method overloading" itself becomes weird, like why do we even have a special name for the idea that getThing(name : String) and getThing(id: Uuid) are not the same method? There's no inherent connection between the two except you call them with the same name. But that's what arguments are for.
|
# ? May 19, 2021 14:52 |
|
they are the same in the sense that anyone reading your code will gloss over the difference at first, and that is the only sameness that actually matters when you're talking about writing code for work that other people or future you will have to read
|
# ? May 19, 2021 15:07 |
|
if they have the same name then the differences should be gloss over able
|
# ? May 19, 2021 15:11 |
|
Ocean of Milk posted:Yeah there's this notion in some OOP texts/systems that methods with different parameters but the same name are somehow "the same", which is bizarre to anyone used to method overloading in statically typed systems. The term "method overloading" itself becomes weird, like why do we even have a special name for the idea that getThing(name : String) and getThing(id: Uuid) are not the same method? There's no inherent connection between the two except you call them with the same name. But that's what arguments are for. the reason they're connected is because oop subtyping can interact with dynamic dispatching in funny ways code:
|
# ? May 19, 2021 15:12 |
|
modern languages like rust, golang, python, et.c intentionally not supporting overloads is one of the best decisions each of them has made
|
# ? May 19, 2021 15:15 |
|
jesus WEP posted:used to work in a financial domain where a lot of fields were like “cumulative amount” or “cumulative quantity”, so agreed My predecessor abbreviated "functional access profile" all over the place.
|
# ? May 19, 2021 15:30 |
|
it actually makes total sense for Calculator.Add(float, float) to return a float, while Calculator.Add(int, int) returns an int
|
# ? May 19, 2021 15:45 |
|
|
# ? Apr 29, 2024 16:36 |
|
code:
|
# ? May 19, 2021 15:54 |