This is just a quick more humanly readable update of what I have been up to in the programming 365 thingy this week. For a more code based version, have a look at the github repo.
Initially, I was going to write a big post once a week and explain what I had done, learnt, how the mood was for the day, how it contributed to the overall project… To do that, I started keeping some notes every day about the key points of the day. Having gotten a bit lazy (can’t try and find time to figure out the big picture), I will just post these notes instead. I don’t think the stand-alone-blog-post format is ultimately the right format for this. Maybe a separate page for it with some categories etc.? In the spirit of Agile, I’ll implement the content now and refactor it later. So without further ado here are the first week’s p365 notes.
What did I do? Implemented a semaphore class. Semaphore class supports indeterminate, filo and fifo release. Wrote some sample code to show the semaphore behaviour.
How did the day go? Pretty successful day. Worked quite hard on different semaphores. Then pulled them together into one class with various impls.
What did I learn? How neatly one can work with condition variables. Overhead required for filo (notify_all) and fifo classes (notify_all and memory footprint).
What? Unit test for the semaphore class. Check that a semaphore does not block when it shouldn’t. Tried out a new unit testing framework – catch. In particular liked the BDD style test facility.
How did it go? Okish – didn’t spend enough time in the morning / during lunch. Had a talk in the evening. So it was grab a couple of minutes whenever possible.
What did I learn? How to add catch to a project. How catch behaves with sections (multiple executions). How much better documented our unit tests would be with BDD. How catch compiles (slowly in the one compilation unit that has the main defined). How catch doesn’t like funky destructor behaviour (like e.g. the thread class has).
Topic: Migrated tests to google. Added tests about blocked behaviour and filo ordering
Mood: Didn’t feel like much progress. A lot of familiar technologies, but learnt some stuff about futures.
What did I learn? Mutex undefined behaviour when it’s locked when it’s being destroyed (urgh). How to write “an infinite loop” type test in Google: Set off a thread and use the future status “status_not_ready”.
Had my first near miss: My sync failed and only my local commit worked. Luckily committing later on still seemed to work and the local commit set the time stamp for the github commit!
Topic: Implemented some topics from chapter three of the Little Book of Semaphores by Downey.
Mood: Mixed – didn’t really learn much, but it felt good to revise the concepts from the book and find that I’m pretty comfortable with them.
What did I learn? That writing a rubbish implementation first is definitely something I do a fair amount of. Today I didn’t get round to nice-fying my implementation so that will have to be done tomorrow. Maybe TDD can help with that?
Topic: Re-organised existing code into three separate projects. Much closer to the structure I want to eventually have.
Mood: Pretty good: I realised that I wouldn’t be able to do that much today (busy day otherwise) so I’m feeling happy with some tidy up even though I didn’t learn or do that much.
What did I learn? Am fairly happy with setting projects and solutions up. Learnt a little more about the “needs to have dll interface” warning. Also learnt that I still need to refer to Joshi’s book to write a self registering factory (argh!).
Topic: Did a complete topic switch to learn a little bit of python.
Mood: Felt fairly ill (too much waiting in an empty, cold house) so decided to treat myself with working through (some of) the python tutorial.
What did I learn? PTVS is an awesome ide for python. How to install python on windows. Lots of basic stuff like variable assignments, control statements, imports, python interactive etc etc.
Topic: Got a little bit further with the python tutorial
Mood: Took it fairly easy today. Running only through a little bit of the python tutorial. Starting to feel a little like this running through a tutorial has done all it can for now. Maybe another day of this and then I’ll try to actually write a little program with python?
What did I learn? Python has got some really neat features. Keyword arguments, arbitrary argument lists and arbitrary list of keyword arguments. Also had some really nice features for working lists and tuples.