« first day (1577 days earlier)      last day (3362 days later) » 

fge
11:19 PM
No
"without many to many"? Database stuff?
 
Yes
 
fge
Not with jooq? :p
 
My teacher showed us how to make an assignment with many to many, But it's bad practice, not to mention that you can have the same person signed up to the same course several times... Lovely...
I'm just working on the design and structure part atm
 
fge
Same person, same course several times?
Uhm
There's a problem to the model, isn't there?
 
Yes
That's why I want to fix it
 
fge
11:22 PM
I don't know for the rest but from what you say I'd have three tables at least here
pupil, course, assignments
And an integrity constraint on assignments
"cannot have the same pupil id/course id pair twice"
 
We have a table of students and a table of courses, You want to sign up students to some courses, and as the assignment was solved by the teachers, it was solved with many to many and so that one student could be signed up to the same course many times
 
fge
And where are the assignments stored then?
 
No that whole thing IS an assignment
There are no assignment tables
 
fge
By assignments I meant the pupil/course "pairs"
 
Yes, they are stored in a third table with the problems I mentioned
 
fge
11:26 PM
Which means the table in question lacks an integrity constraint
But that's "all" there is to it
 
I think so. I'm just thinking about the design for the third table
 
fge
You can't really "fix" the model here, there really is no other way to store such a relationship
Well, a simple student id/course id pair
With foreign keys and a double unique index on the two columns
 
But that won't work well with double IDs because then only one person can join one class
 
fge
This table does not need a primary key
No
As the index is on the two columns, it means that the unicity has to be on the (student id, course id) pair
 
To begin with, I would have wanted to structure it with each class having their own table, you refer the students attending it in there and then you make a table of the avalible students and the courses
 
fge
11:31 PM
That's not a good solution
A class is a relation
Therefore a table
 
Yes, I'd have a class table
And then you link those tables into the table of courses
Not saying my plan is perfect...
 
fge
Wait, what are the courses?
One course is, I gather, a class, a list of students and a time?
But then the list of students by classes is "fixed", right?
 
So far I made it look like this: docs.google.com/spreadsheets/d/…
 
fge
Aah, OK, so there is no notion of a class
 
CoursesTaken is a part of me thinkning about a normalisation where each student have their own table of courses they are attending
 
fge
11:38 PM
That should not be the approach you take
That violates 1NF
 
The coursesTaken one or what's in the documents?
 
fge
coursesTaken
That's why I suggested what I said earlier
 
Yeah, that's why I haven't done it
 
fge
A table with column (student id, course id) with a unique double index on both columns
Also, the examinations should be in another table
 
@Gemtastic ignore this just testing
 
11:39 PM
@fge But as I said; won't that make it so that only one student can sign up to one class?
 
fge
No, again
The unicity is enforced on the pair
Not on individual columns
That is, there cannot be twice the same pair (student id, course id)
 
@fge I was just filling up the table. Everything in them are filler, just so you get the idea. I think - por ejemplo - that "teacher" on the course is in itself an issue since one course can have more than one teacher
It's not the norm, but I have three teachers in the course I have now >_>
@fge I haven't been taught how to creat a unicy on a pair, I thought you couldn't do that
But of course you can >_>
 
fge
Are you talking about your database or your school here? :p
Sure you can, and that's the strong point of RDBMS engines
(well, except MySQL)
 
@fge I'm using my school as an example to my tables
@fge MySQL and JDBC is what we've been taught
 
fge
At least use H2, since you do Java
:p
 
11:43 PM
H2?
Hibernate?
 
I have to use a SQL database
 
fge
I use that in my debugger
And H2 is one
 
It's in the course requirements
 
fge
Well, as I said, h2 is one
They cannot tell you off for using it
It is an SQL database
 
11:44 PM
I intend to try as many databases I can find
But First, I have to have the design right
 
fge
It just happens that it is in pure Java and very easy to embed (in addition to being pretty quick)
 
I want to try PostgreSQL too
It looks nice
 
fge
OK, here's a tip for the design: identify the relations, and the joins between them; try then and see if the design is 1NF, then 2NF
1NF is simple
A database design is 1NF if you can refer to all columns of your table in a where clause in full
That is, all columns are "atomic", so to speak
 
I'm trying to think of it in 3NF
But I'm also trying to think of it in a larger point of view where the tables need to refer to each other
 
fge
It is 2NF if the relation, that is all columns in a row, are dependent on the whole key
And it is 3NF if you cannot derive the value of a column from the value of another column
As long as it's 3NF, the tables will naturally refer to each other, that's not the problem
Think NF first
 
11:49 PM
Well, 1NF is the first step, then you build it out
 
fge
The difficulty you can have is actually querying, but you are guaranteed that it is doable
It's mathematically proven
 
I doubt the querying will be a problem, the issue to me is to have a nice design to begin with.
 
fge
But really, try jooq and h2 ;) They are a killer combination
Yes, and the design also depends on your "business requirements"
What do you want to query
 
When it comes to the design the framework for the querying is irrelevant, because I don't have the design yet. I could agree to that it might be nice to design to a framework, but I haven't gotten that far yet
 
fge
Don't try and connect everything to everything
I'm not talking about designing a framework at all
I'm actually talking about tools to make the design and code
 
Ago
11:52 PM
I want to test some code which reads information from System.in. I understand I can use System.setIn(some input stream). everything works. but now I want to change the input during my test. the problem is, if I call System.setIn(..) again, nothing changes - still the previous stream is available. any suggestions?
 
In this case we need to connect things to each other. A school needs to know which the courses are, which the students are and what student is attending what class
 
fge
Yes, but for instance a class doesn't give a beep about courses
 
Then we have other things like what grade they got, what period they studied at the school and so on so forth...
 
fge
@Ago can't you just read from somewhere else than System.in in your tests?
 
We're not mentioning the classes though...
Let's not use the word class unless we refer to a java class
 
Ago
11:54 PM
@fge the code is already implemented to use System.in. I cannot really change that. Of course, if nothing else works, I have to think about changing
 
Lesson is a better word if you want to break down the courses into lessons
 
fge
@Ago you should try and change that before it's too late -- that is, now
Don't let this "slight problem" become a burden
It is a slight problem now
In the future it may not be
Especially since System.in is, well, not really reliable
 

« first day (1577 days earlier)      last day (3362 days later) »