Planning the Model

Now I’ve got my CI server ready to build my project when I make a change and SonarQube installed and ready to tell me off for coding errors and test coverage, I can actually start planning to write some code.

I need to plan out my model. There have been sections in a couple of modules about this so I think it’s probably best to use the method taught at the OU – that should hopefully get me some brownie points. Basically I need to describe the product and then pull out nouns and noun phrases as class candidates.This should hopefully also get me some basic attributes for the classes to. So here it goes…

The system’s scheduler will kick off a process twice a day. In the morning the system will check a weather service for key pieces of data – did it rain overnight, if so, how much, is it predicted to rain today and if so, how heavy will it be? Using this weather forecast and history the system will be calculate whether the garden should be watered and for how long. If the system decides that the garden should be watered then it will send a request over the network to one or more nodes to open their valves for a set amount of time. The nodes will reply with a response containing a success or failure status and any errors if they occurred. The weather forecast, request to the nodes and response from the nodes will be saved into the database.

This process will be repeated in the evening to check whether the forecast was correct and no action is needed or whether the garden needs watering.

A web interface will be provided so that users can see a history of watering jobs, their status and any errors associated with them. Users will also be able to see charts displaying information regarding water usage and rain fall for set periods of time. Finally users will be able to initiate watering through the interface.

From the description we try and pull out some relevant nouns and decide if they are a possible class, attribute of a class or should be rejected.

  • System –  the whole system, out of scope
  • Scheduler – Possible class
  • Process – Possible class
  • Day – Event
  • Morning – Event – could be an attribute of process?
  • Weather service – Possible class
  • Pieces of data – Too vague
  • Weather forecast – Possible class
  • Weather history – Possible class
  • Rain – Possible attribute of weather forecast
  • Garden – out of scope
  • Request (to water) – Possible Class
  • Node – out of scope
  • Valve – Interface to which could be a possible class
  • Amount of time – attribute of RequestToWater
  • Response (from watering) – Possible class
  • Success or failure status – possible attribute of ResponseFromWatering
  • Error – possible attribute of ResponseFromWatering
  • Request to the node – duplicate of RequestToWater
  • Response from the node – duplicate of ResponseFromWatering
  • Database – Possible class (Data Access Object (DAO))
  • Evening – Event
  • Action – duplicate of RequestToWater?
  • Web interface – too abstract
  • Watering job – Same as process?
  • User – Possible class
  • Chart – Possible class
  • Water usage – Possible class
  • Rain fall – Possible class
  • Period of time – an attribute of a request for data?

The web interface is part of a later phase so we’ll disregard possible classes from there for the time being.

For our key domain I think we have…

Scheduler

  • Morning trigger time
  • Event trigger time

Weather Service

Weather Forecast

  • Probability of rain
  • Predicted temperature

Weather History

  • Did it rain?
  • Amount of rain
  • Average temperature

IrrigationRequest

  • Amount of time to water

IrrigationResponse

  • Success?
  • Error(s)

Process/Job

  • Time Started
  • Started manually or by the scheduler
  • Forecast
  • History
  • Request
  • Response

DAO

I think that looks like a good place to start. I’m sure I’ll need some more attributes and such. In addition to actually setting up the classes I want to get the architecture in place to do persistence tests in the build using a lightweight database like H2.

OU Final Project Proposal

I realised after my last post that I hadn’t even mentioned what I’m actually planning on doing. Here’s the introduction from my proposal.

Many people enjoy a beautiful, well-maintained garden. However, some people are also lazy and forgetful so remembering to water the garden once or twice a day in the summer can be a challenge. During a hot dry summer it only takes a few missed days of watering to ruin months of effort. Removing this worry will mean less stress for the lazy and forgetful gardeners of the world and lead to consistently watered gardens.

The solution to this issue is a system that runs everyday without human intervention. It should know whether the garden needs watering based on weather forecasts and turn on a sprinkler system if required.

A distributed software system will be delivered at the end of this project that will consist of one or more watering nodes and a central server that will coordinate whether and for how long the garden should be watered. The central server will provide a web interface so users can monitor the system. In addition to the software components, hardware that will run the watering node software and control the flow of water will also be delivered.

Choosing a Continuous Integration Server

Before I write any code I want to make sure tests are run, code is analysed for bugs and the formatting checked straightaway and every time code is changed. This means choosing a continuous integration server (or service). The choices are…

‘Jenkins CI is the leading open-source continuous integration server’ (Jenkins-ci.org, 2015). However this should not make Jenkins the default choice. TeamCity is not open source, but licenses for individuals (up to 3 build servers and 20 projects) are free.  TeamCity has the advantage of built in integration with Maven which is the build tool I am using for this project. Jenkins requires a plugin to be installed. TeamCity is also what I use at work so familiarity would be helpful.

TeamCity and Jenkins both have the same down side though. Both will require me to install them on a machine and have them running all day. Not only does this mean keeping my iMac on 24/7 it also means going through the hassle of installing it and setting up a database. Travis CI doesn’t have this problem because it’s web based. You just create an account, point it at a Github repo and it’ll run the command that makes the most sense (mvn test if you have a pom.xml) when it detects a change.

For running unit tests and running static analysis plugins like FindBugs and Checkstyle Travis CI should be fine. I may run into problems when I want to do something a little more advanced. SonarQube is the current top dog for static analysis. It highlights problem areas, measures test coverage and calculates technical debt. It provides a really nice dashboard showing all this data. SonarQube requires the CI server to be able to connect to the SonarQube instance which would be a lot easier (and more secure) if they were both located within the same network. It looks like the setup for integration tests that use Selenium web driver to fire up a browser and perform actions could be a time sink. I could definitely see a few evenings being lost there.

Due to time constraints it makes most sense to use Travis CI until a something comes up that it can’t do.

Open University Final Project

After over five years I’m finally on the home stretch of my OU degree in Computing. I just need to finish one module that ends in June and complete my final project in September.

I’ve chosen to do a development project as that’s the area that I think I can most shine. It isn’t, however, just a case of hacking together some code and submitting it. Decisions need to be justified and a large part of your mark comes from the planning of the project and reflection on how things went at the end.

This means I’m going to have to write a whole bunch of stuff about tools I’m going to use and decisions I make. I might as well do that here so I’ve got a good record. Let’s hope I actually keep it up.

Code and other stuff is hosted here https://github.com/Louisblack/Final-Project. At the moment it’s just some skeleton projects.

Books Read In 2014

It’s that time of year again. I don’t think I’m going to finish The Lovely Bones before Thursday so this is my list of books for 2014.

I ended up abandoning Homicide – A Year on the Killing Streets, the book that The Wire is based on, about half way in. It was alright but reading about Baltimore’s crime problems in a hammock in Costa Rica didn’t feel right. I also tried to read Naked Lunch but couldn’t get more than a couple of chapters into it.

My favourites of the year were Lucifer’s Hammer and The Martian – strangely enough both sci fi.

  1. Masters of Doom – David Kushner
  2. Life On Air – David Attenborough
  3. The Ocean at the End of the Lane – Neil Gaiman
  4. MaddAddam – Margaret Atwood
  5. On The Road – Jack Kerouac
  6. Into the Wild – Jon Krakauer
  7. The Returned – Jason Mott
  8. The Adventures of Tom Sawyer – Mark Twain
  9. The Fall of Moondust – Arthur C. Clarke
  10. Lucifer’s Hammer – Larry Niven and Jerry Pournelle
  11. Death in a Northern Town – Peter Mckeirmen
  12. Lair – James Herbert
  13. The Cipher – Kathe Koja
  14. A Journey to the Centre of the Earth – Jules Verne
  15. The Incredible Human Journey – Alice Roberts
  16. To Kill A Mockingbird – Harper Lee
  17. Twelve Years a Slave – Solomon Northup
  18. The Plague – Albert Camus
  19. The Haunting of Hill House – Shirley Jackson
  20. The Martian – Andy Weir
  21. The Fall – Guillermo Del Toro and Chuck Hogan
  22. On The Beach – Nevil Shute Norway
  23. The Forever War – Joe Haldeman
  24. Caves of Steel – Issac Asimov
  25. Horns – Joe Hill

Ada Lovelace day at SCHS

There is a severe lack of women in the technology industry. Very few programmers are women and very few women hold senior positions in technology companies. This is a problem because technology is shaping the way we live and women risk being left out of the conversation.

Ada Lovelace was the world’s first computer programme. Ada Lovelace day takes place every year on 14th October to celebrate women in STEM (Science, Technology, Engineering and Mathematics) and encourage women and girls to choose this path. I took part in an event last week at Streatham and Clapham High School, an all girls school in London, to show the students some things you can do with code.

I decided early on that I wanted to do something with the APIs (Application Programming Interfaces) provided by websites like Facebook and Instagram to show how we can use our own data and that of our friends. After a lot of preparation, time, refinement and help from some great volunteers I managed to get an hour long introduction to programming session ready to go.

At work I’ve fallen into the role of main Javascript trainer. Most of our developers are Java guys so I train people of all skill levels and I’m often training with years more programming experience than I have. However, even with that the idea of teaching a group of teenagers was frightening. They’re far more unpredictable than your average dev.

I was scheduled to run the session for two different groups – one 15-16 year olds and one for 17-18 year olds. The younger group came in first. I hadn’t had enough time to set up all the computers with the skeleton code I’d prepared so I naively asked the kids to copy it from the network drive and open it on their machine. Lots of them opened it on the shared drive which caused lots of confusion. I also realised quite early on that we weren’t going to cover nearly as much as I had planned so I had to do a bit of on the fly rejigging to make sure we got to the big pay off of using their own pictures.

I managed to set up the computers for the second session so it went a lot better. We managed to cover a bit more and the kids seemed calmer, more relaxed and more attentive.

I don’t know if I managed to encourage anyone to learn to code. There were definitely some kids there that picked it up quickly and were helping others. Programming is a difficult thing to teach in an hour. At the start it’s weird, difficult and frustrating but once you get over the first few hurdles it becomes a wonderful skill to possess. It’s still weird, difficult and frustrating but the things you can do with it are amazing.

Before the day started I would have said I wouldn’t want to do it again. The preparation work alone was pretty full on. However after the second session I could still see lots of improvements that I could make to my presenting style and the material being taught. I almost feel like it would be a waste to not try and build on what I’ve learnt. If the school asks me back next year then I’d certainly say yes.

 

 

M363 and M364 post mortem

Almost two weeks ago now I finally finished the two OU modules I’ve been suffering with for a good portion of 2014. I wrote back in April about the quality of level 3 computing modules and my opinions only hardened as I slogged away at the work. A few months after that last blog post I even considered packing it all in as I wasn’t really learning anything useful and studying two level 3 courses concurrently meant that my time was being wiped out. Luckily I got some advice and decided to stick with it. I’ve now just got one more module and my final project to complete.

M363 sounds like it should be cool. It’s user friendly name is Software engineering with objects. It ended up being 6 months of UML diagrams and requirements analysis followed by a couple of months on managerial techniques, basic QA and stuff like estimating how long a project might take. I can’t remember writing any code which is pretty shit for a module called Software Engineering with Objects.

The exam ended up being relatively easy to revise for. I felt confident going in and think I did pretty well. Annoyingly I didn’t do well enough in the assignments to get a first overall even if I aced the exam but I’m pretty sure I’ve got a 2:1.

M364 is a module focusing on Interaction Design. I think there was definitely some interesting material in there somewhere but it ended up being lost in the huge amounts of reading. The OU supply you with a copy of the book Interaction Design: beyond human computer interaction which is an 800 page beast that could easily be distilled down into less than half of that.

The marking for the assignments I think suffered from the inherent subjectivity of the course. Analysing websites and interactive products based on their usability and user experience can lead to lots of opinions being thrown around – some you can back up and some you can’t. This lead to some varied marks. I got as low as 75% and as high as 98% on my assignments.

The exam is where things got very annoying though. The course is filled with lists of things – usability goals, user experience goals,  Hofstede’s cultural dimensions, evaluation methods with their advantages and disadvantages. I’m not fantastic at remembering lists of words – I prefer getting my head around concepts. I did four past papers in preparation and in every one they managed to find a new list of things for you to regurgitate. Sometimes that list was mentioned just once in the course book’s 800 pages.

I don’t think I did very well in the exam but because of its subjective nature it’s hard to tell. I’ll find out in December.

Luckily the OU is refreshing its level 3 courses over the next few years so hopefully these modules will be retired or re-written.

 

 

A Disappointing Way To End An OU Computing Degree

I’ve been doing an Open University degree in Computing for the past 4 years now. It’s definitely had its ups (writing my first line of code, introducing me to Java) and downs (that team working module) but on the most part it’s been pretty interesting and I’ve been happy with most modules I’ve done. In fact, after doing three modules of Java I got myself a job writing Java full time.

The problem is that fact that the quality of the module choices drops off dramatically at level 3. Last year I did the only module that sounded interesting and had decent reviews (Developing Concurrent, Distributed Systems) which was dated but still useful.

This has left me with a pretty poor choice this year. I’ve ended up doing The Fundamentals of Interaction Design which is a six year old course that feels dated and any useful material is lost in the plentiful, dry reading. I’m also doing Software Engineering With Objects that is just a lesson in UML and actually just seems to be rehashing material from a module I did last year.

I think I’m just disappointed because I expected level 3 modules to cover more meaty subjects as the level 2 ones had laid down a good foundation of language skills. We could be writing a compiler to better understand what’s going on when we hit build or building a game engine with basic physics and AI. I know that’s all stuff you can learn independently but so it everything else on the course so why not offer advanced students something a bit more computer sciencey.

It also doesn’t help that these two modules still take up a good chunk of my time. I’d rather be doing something a bit more interesting like learning Angular.js or building something with an Arduino.

After these I have one more proper module, Algorithms, data structures and compatibility (using Python) which actually sounds pretty fun, and then it’s final project time.

 

Good Energy

After over two years of renovating our house my girlfriend Jordan and I finally moved in at the start of December. There’s still an enormous list of things that need to be done but I’ve just finished sorting out something I’ve been thinking about for a while.

As always at winter there’s been a lot talk in the news about energy companies and price rises. Luckily at the moment price isn’t an huge issue for me (although I’d obviously prefer prices not to rise much more for everyone’s sake) but being a bit eco I’m concerned about how the energy I use is produced. I like to have a warm house too much and have far too many electrical devices each sucking up lots of electricity for me to think seriously consider using less energy so having the energy I use produced from renewable sources seems to be the way to go.

At first I started looking at Ecotricity. When I checked their website they were claiming that 80% or thereabouts of their energy was produced from renewable sources. I’ve just checked now and they are saying it’s 100%. The other big green energy supplier, Good Energy, was claiming 100% back in October when I first looked so that’s who I signed up with. I was also recommended by a friend so we both ended up with around £50 credit from their recommend a friend scheme. Their prices are a little lower than the big six suppliers I’ve checked against and they didn’t raise their prices this winter.

The switching process has been a bit of a ball ache all in all. I phoned up and requested a switch over sometime in October. I didn’t receive the direct debit forms so had to phone up and get them to send them out. We then received letters with provisional switchover dates saying direct debit would be taken for gas would start in January and electricity would be in February. In January both direct debits came out and when I called about it they said they’d been supplying our electricity since December and they had taken an estimated meter reading to determine what we owed e-on. It’s a bit rubbish for a company to take money before they say they will. If I hadn’t had enough in that account I would have been charged. Apparently they reckon they had a new letter generation system but in in November and have been having problems with that but I’m sure that’s what companies always say!

So overall the switching process was rubbish but hopefully things will be better now. At least now I don’t have to feel guilty about only half watching a program on my big TV and surround sound while I dick around on my laptop.

New Years Resolutions

Happy new year!

I don’t usually bother with new years resolutions. Most are doomed to failure and I’m not usually the most committed person when it comes to doing things I don’t want to do or not doing things I want to. This year though I’ve got a couple of things that I actually really want to do so I’m hoping I should be more successful. I should also hopefully have a bit more free time as the big project of renovating the house I bought in 2011 is finally over.

The first one is to program more in my own time. I got a job as a developer in November 2012 so I do spend five days a week programming. I’m also lucky enough that my team gets to work on some really interesting projects so I do get a lot of variation in my day job.

The reason I want to work on more projects at home is to do stuff that’s completely different like simple games or use tools I don’t get to use at work. For example we use use the Javascript framework Dojo at work instead of JQuery. This means my knowledge of JQuery is woefully inadequate. When I come to looking for another job this is going to really harm my chances. The last reason is that I don’t really have many examples of my code on the web. Again when I’m looking for another job this is going to bite me in the arse. Checking a candidate’s Github page is pretty standard practice when recruiting a developer I imagine.

I’m hoping that doing small achievable projects will mean I’ll actually finish things and keep my interested. Now I need to just think of something (suggestions welcome!).

My other resolution is to blog more. I hardly posted anything last year and very little the year before. I should have been writing about my experiences working on my Open University degree or technologies we’re using at work. Writing about stuff tends to solidify knowledge so I’m sure it would help with work and studying. Again this should help my chances when looking to move jobs as my blog comes up as one of the first results when you Google my name. Hopefully if my first resolution works out then the projects will give me material to blog about.

Anyway, here’s to a good one!