« first day (3854 days earlier)      last day (1092 days later) » 
03:00 - 22:0022:00 - 00:00

jrh
10:00 PM
the strings to a user wouldn't make sense out of context without looking at where they're used
 
Because it's intelligible. You can break it down to component parts in storage and then build it back up when querying. You cant do **** if a field is in a complex structure easily
Postgres, I think, will allow you to do searches through JSON objects now, though. Maybe I don't know enough to leverage this capability in a sensible way
Even then, it doesn't address pulling out a sparse array?
 
jrh
@roganjosh it's true that splitting it up like that would allow you to more easily query individual strings, but I can't see a usecase where you'd need to do that
string sets wouldn't even be reusable
 
So drop stringValues in your analogy. I overlooked that you had a middleman in that example sorry
 
jrh
ok, so stringSets=[id, stringSetIndex, stringIndex, stringValue], thingThatUsesStrings=[id, stringSetID]
technically the id is redundant, stringSetIndex and stringIndex would identify a string uniquely
I could persuade Django to use something like this but I'm pretty sure it wouldn't autogenerate it using a ManyToManyField
I still don't really get the benefit though. If each stringSet (every unique stringSetIndex) is independent and never used more than once, what is the value add of this vs just using json?
 
I'm reluctant to say "yes" to the new example because it's not familiar syntax. But if it's on the same thinking that I'm trying to convey, then it isn't a many-to-many relationship now, but rather a one-to-many
 
jrh
10:11 PM
it's kinda hard to visualize without pictures, I can make one
One to many, yeah, possibly. In usesStringSet each tuple references multiple ordered strings
I dislike the idea of storing data in strings in general (not just in databases), to be fair. I have had enough weird quirks happen when parsing data to avoid it when possible. However arrays of strings are pretty hard to screw up, and I'd be storing them (instead of having to read somebody else's string), so it's tempting this time.
The other thing is, you wouldn't want to use a string set more than once, because if you edited one and it changed the behavior of a different item in usesStringSet, that'd be unexpected and weird. This table setup to me feels like a design optimized for re-using sets
 
10:29 PM
Why would you even store the string?
That's duplication of data. You can generate the string on-the-fly on a query
 
jrh
The values of the strings wouldn't really be "Set 0, index 0", it'd be the name of something
the application wouldn't be able to generate those strings, they'd be user specified
 
Fair enough. I still prefer that layout to the second in JSON
 
jrh
Not trying to be a broken record or anything, but can you explain why? In what use case is it better?
You mentioned component parts but the string arrays are more or less unique and atomic, in theory split-able but I can't think of a practical use for it
 
I started typing but let's reverse the question; if it's so irrelevant then why do you care?
I feel we're just debating semantics and "that's the way it's done". If it's not an issue for you, then you wouldn't be asking, right?
To me, it makes things easily separable into models
 
jrh
@roganjosh To me this table structure doesn't represent the real structure of the data, conceptually. It makes it sound like the strings are somehow related even though they aren't, and the whole setup is held together by indexes across two tables. The context is less clear; really the only "key" is the id on usesStringSet, and the value is the strings, the table in the middle adds additional relations just for the sake of it, I feel
I'm asking all this because I'm trying to get into the django mindset, one one hand Models seem nice, but on the other hand I don't think they're a drop in replacement for every object I'd ever make either
 
10:40 PM
I have to disagree with you, but I know where you're coming from as I felt the same. Unfortunately, I can't think of a good example to convince you
 
jrh
So I either have to accept these cross indexes as "the way django people like it" (which is okay), or make my own models that wrap complex objects
the former I will absolutely hit a wall, even if I do my best to support it, it's just a matter of time until I have to do the latter
@roganjosh it's okay, I appreciate the advice
 
I don't even use django (partially for how complicated this was to me when I was learning) but I use Flask pretty much every day
 
jrh
I've used DBs before, I've done a ton of Python, but this is my first time using an ORM
I like databases, they're great, but it feels like a dramatic step down in design tools
and a lot of the stuff I value like keeping stuff related together just kinda goes out the window
@roganjosh How would you say that Flask differs? Just out of curiosity.
 
@jrh It's way more bare-bones when you start. You can read the flask mega tutorial which I think is super. That aside, you still break your code down to functions/classes/modules right? Why do that when you can just have a module that can run everything sequentially and solve the problem?
 
jrh
I don't think I understand your question, I do use functions/classes/modules, sure. A module that runs everything sequentially sounds like literally just running a completed program from start to finish. It'd consist of those functions/classes/modules.
 
10:49 PM
No, I mean a script, then, without your own functions or anything else. It just runs top-to-bottom
 
jrh
So just run somebody else's program? Sure I guess, if it met all my requirements, but if that were the case I wouldn't have anything to do.
As far as I know there's no FOSS thing that does what I'm looking for and I'm not looking to pay for it either (I doubt a paid option exists either)
 
I never suggested it was someone else's script. I'm saying it's your script that just has a giant block of code that executes from top to bottom. Would you write that?
 
jrh
Oh OK. No, I wouldn't
 
So now see how storing this pre-formed list looks to me on the DB side
 
jrh
So I wouldn't make one giant block of code because it's not, for example, meeting DRY
but if I never repeat anything, YAGNI
You could make a function out of every single line of code too just in case it's reused
 
10:55 PM
Is that your counter-argument?
 
jrh
If I were making a string repository that you can select from, I'm all on board, but I'm not sure there's a case for keeping that layer of indirection
I think it's a bit of a weird metaphor, but yeah, I suppose
 
I think I'm getting bored of this. I understand your thinking, but I'm not prepared to go in circles with this. You can see the lunacy in having everything bundled into a script with no functions or anything, but you're now countering with this. What you're doing with the DB is the former
 
jrh
I don't see how those two things are really related to be honest (code structuring and the DB design thought process). Fair enough though.
 
Cluttered and poor design
 
jrh
It's poor design, but why? What is the problem with it? It's not how other people do it?
I can say why one file with no functions/etc is bad (hard to read, probably repetitions in logic, hard to re-use, etc)
It's alright if you've had enough though, I'll see what I can find online
 
03:00 - 22:0022:00 - 00:00

« first day (3854 days earlier)      last day (1092 days later) »