Using Pharo to Plan A Semester Schedule

Using Pharo to Plan A Semester Schedule

Today I had to draft a milestone plan for a student doing a bachelor project. (In our university we have a special "Bachelor Project" course where we are trying to make sure that students stay on track while doing their projects). So I had to check milestones for the previous semester and come up with new ones.

⚠️ Disclaimer: this blog post was written some years ago, so if you want to try out the examples and see something reasonable, please replace the Date today parts with '9 October 2015' asDate (the original publication date).

First question: "How much time is there in this semester compared to the last one?" Funny thing is that I could just copy a date from the last semester course's website and send #asDate to it. I ended up with:

(('27 May 2015' asDate - '19 February 2015' asDate)
-
('1 Jan 2016' asDate - Date today))

and this semester is 13 days short, almost 2 weeks.

Next question: "How big were timeframes between the old milestones?" Again, copy the dates, convert them to date objects, calculate the difference between adjacent milestones (and maybe scale the value to the number of weeks).

(#(
'19 February 2015'
'25 February 2015'
'25 March 2015'
'15 April 2015'
'27 May 2015') collect: #asDate)
    overlappingPairsCollect: [ :prev :next |
        (next - prev) days / 7 ]

Now, as we have 5 milestones (separated by the time intervals of 1, 4, 3, and 6 weeks) and 13 days less than in the previous semester, how about boldly reducing timeframes by 4 days and adding them to today's date?

((#(
'19 February 2015'
'25 February 2015'
'25 March 2015'
'15 April 2015'
'27 May 2015') collect: #asDate)
    overlappingPairsCollect: [ :prev :next |
        next - prev - 4 days ])

inject: (OrderedCollection with: Date today)
into: [ :milestones :timeframe  |
    milestones
        add: (milestones last + timeframe) asDate;
        yourself ]

And then we can click through the milestones and see on a calendar whether the dates are not on the weekends and make sense at all.

Screen Shot 2015-10-09 at 15.38.02.png

That's all. Probably you can do a cool inspector presentation to aid you. But if you consider that my task was not recurring, using existing tools was enough.