title: Program design of a timetable creator
body: <p>For fun, I want to write a timetable creator in python for schools. I.e. a program where schools can input their rooms, teachers, classes and subjects and some preferences and which will output a timetable for each class/teacher/room. I don't have a problem with the logic behind this (because that is the part I am most interested in), but I do have a problem with the design (due to inexperience in writing something big from scratch). </p>
  
  <p>So assume I have a list of rooms (101, 102, ...), a list of teachers (Mr A, Mrs B, ...), a list of subjects (math, english, ...) and a list of classes (5, 6, ...).</p>
  
  <p>Now some rooms are better suited for different subjects (like 101 is good for math &amp; english, but geography must be in 102, if possible). Of course, every teacher has a certain set of subjects he teaches.</p>
  
  <p>Also, the classes are parted in different groups. I.e. class year 5 is parted in 5-a and 5-b for all subjects except sports (where it may be 5-groupX and 5-groupY) and another subject, where it may be 5-group1, 5-group2 and 5-group3. </p>
  
  <p>It would be nice if someone could give me some advice on how to efficiently save this data / design my classes, so I can write some nice code. </p>
  
  <p>My first guess would be something like (pseude code):</p>
  
  <pre><code>class Room:
      string name     # e.g. r102.name = "102"
      int id          # that should be unique?
  
  class Subject:
      string name     
      int id          
      map RoomPref    # like geography.Roompref[r102.id] = 1.0 
                      # or math.Roompref[r101.id] = 0.75 
  
  class Teacher:  
      list Subjects   # like MrsB.Subjects = {geography.id, math.id}
  </code></pre>
  
  <p>etc, etc, but I am not sure if this approach is good and leads to nice code. Especially all the different interconnections pose a problem to me.  (Is assigning different IDs a good solution?)</p>
  
  <p>Advice and/or reading material is welcome.</p>