Developer Training
Let’s chat about an idea I had for a training project; something to bring someone from an academic environment into a mildly professional environment. When I first started at the ESL, I was given a relatively simple project… after I was given a fair amount of grunt work you’d expect of a high school intern. I spent more time then I should have on that project, but in retrospect I realize that, if adapted slightly, it’s perfect for bringing someone up to speed on things like databases, ORM, .NET, how the web actually works, etc.
Background
Part of what our lab used to do is maintain a database of hourly weather readings at sites across the state. In the past we received emails from the Meteorology department with a fixed width file that contained the relevant data; and we would parse these emails with a cron job on an ancient UNIX machine; the data going into an Informix database. For one reason or another this system needed to be shutdown (Meteorology stopped sending emails; UNIX machine got hacked and destroyed; desire to make the data more accessible; etc).
The original goal of this project was to replace the old system with a more accessible system; in our case using Microsoft technologies (SQL Server for data storage; and a .NET language for data retrieval). The new goal is to do this while iterating through technologies that you’ll encounter in your everyday life.
Data
I figure this is worth spelling out first. Previously we received data in the form of an email. Where precisely are we going to get weather data now? We can’t just go around installing internet enabled weather stations… this is only a training project, not a mass system deployment (sadly).
As it happens, NOAA provides the (current) weather readings in a freely available XML format. As an example: http://www.weather.gov/xml/current_obs/KCLL.xml is for Easterwood Airport, College Station, TX. They provide these for many locales, listed here: http://www.weather.gov/xml/current_obs/seek.php?state=tx&Find;=Find. Most of the XML files will update only once an hour, but there are a few that’ll update more often.
Goal
The goal is to, given a list of weather stations (either URL’s or just station names), write a service that periodically pulls down the weather data for each station, parses it, and puts it into some form of long term data storage. Duplicate readings (ie the weather station hasn’t updated) shouldn’t be stored. Also, the XML files contain a fair bit of extraneous data that can be done without; we can ignore anything extra.
Advised Process
- Start by getting source control setup.
- If getting an svn server is too much overhead, look into using Bazaar, git, Mercurial, just some form of source control.
- Setup a project / solution structure. In our lab we would have a root project folder containing overhead files (solution file, build files, etc), and then a Source folder and a Database folder under the root.
- Throughout this I’ll mention that ‘everything should be in source control’ at the end of an iteration. This is not to imply that that is the one specific point to check in all your changes to date. Source control should be an integrated part of development: once you hit a milestone, it’s time to do a commit. Remember, ’commit early, commit often’. Just don’t commit broken things.
- For a first iteration, download a single file, parse it, and display it to the screen
- Interjecting a bit of personal thought; when you first attempt this, try it using a Raw Socket, and the HTTP protocol. Not because it’s advisable (it’s not), but because it shows you the foundation on which the web is built. It’s good to understand this most basic building block.
- Once you’ve had fun with raw sockets, look into what your language provides by default for making web requests. C# provides a WebRequest object with a Create method that can be used; Java, python, etc probably provide something similar.
- For Parsing. DO NOT USE ANY METHODS ON THE STRING CLASS. Parsing XML by hand is something that you will be shot for: it’s a death penalty offense. Look into what your language provides for XML Parsing.
- For storage; for this first iteration, just store to a flat file; one entry per line.
And that’s it for the first iteration. Make sure everything is in source control, and have a senior fellow review what you’ve done. At this point the senior is looking for basic faults: did you name a public property ‘theTemperatureRightNow’ or ‘Temp’; as well as basic class structure.
- The next element is to add configuration, multiple stations, and the ’service’ aspect to it.
- .NET configuration is usually done through a file called app.config (later renamed to AppName.<extension>.config), and is accessible through System.Configuration.ConfigurationManager ; I’m not sufficiently familiar with other languages to say what’s available; but writing a Config Manager isn’t terribly difficult if your language doesn’t provide it.
- When I say service; I don’t necessarily mean a Windows Service (or unix dameon process); just a program that contains something akin to for(a very long time). At the simplest level, this can be done with a while(true) loop, with a 15 minute thread sleep. Your language may also provide a Timer construct specifically for firing off threads at specific intervals; using that would be perfectly valid too.
NOTE: this isn’t something that would be repeated once every second, or once every minute. The data updates at best once every fifteen minutes; common ettiquete demands that ~fifteen minutes be your shortest pause. - Logging would also be good to play around with at this point. Most logging packages also come with a form of file configuration; look into playing with that a bit.
At this point we have a configurable service that will pull down data from any number of weather stations, and parse out the bits we want. Put everything in source control, get a senior to do a quick review of what you’ve done, and listen to any comments they have.
- Next, we’re going to add database storage.
- Determine an appropriate database schema. I would suggest two tables, one carrying weather station information, the other carrying reading information. A reading should have a link back to its weather station; and each table a primary key.
- For this version, use the raw API’s provided by your platform/language; learn the joys of SqlConnection, SqlDataReader, and parametrized queries.
So, again, everything in source control; have a senior look at it. At this point, database design and class structure are probably most important; the data storage layer should have a well defined, simple interface that doesn’t cause a headache on viewing.
Also at this point, you should have a starting idea for what SQL is like. The project should be far enough along that it can collect data. Let it run for a day, and play around with getting interesting weather stats in SQL.
- An ORM layer
- If the data access component was coded to both save and load Weather Readings, then it’s probably possible to extrapolate the fact that writing this transform code sucks. A lot. If left with only SQL, a developer can spend a few days working out data access for a mildly complex object; potentially weeks with things more complex.
ORM fixes this by implementing a wrapper layer for the whole of SQL Transformation; your only job in turn is to define what’s relevant to the transformation.
- Implement another Data Storage class using an ORM technology. Use the same interface as the SQL storage class above.
That’s it for this one. Call a senior over to see what you’ve done; they should be checking to see that everything makes sense, looking for possible points of confusion, etc.
- If the data access component was coded to both save and load Weather Readings, then it’s probably possible to extrapolate the fact that writing this transform code sucks. A lot. If left with only SQL, a developer can spend a few days working out data access for a mildly complex object; potentially weeks with things more complex.
And that’s it for now. It could be extended to include things like Dependency Injection for choosing the output method; a web application fed off the database to get summary data, which can in turn evolve into an AJAX web app with web service back end. You could also go the route of a desktop summary viewer if that’s relevant to what you do. You can attempt more random and off the wall ideas- try to build a temperature map off the data and an overlay of the state map; AI algorithms for predicting the next hours readings; statistical analysis (linear regression to predict temperature at a station that didn’t report); feeding the data into a weather simulation in an MMO. All manner of things.
There’s also a bit of unit testing / TDD possibility, though I’m not certain it’s quite complicated enough to warrant it, and a TDD intro is probably better done by pairing at first, which goes against the goal of a (mostly) solo training project.
Conclusion
I have presented a poorly worded and untested training project. This project is suitable for use as a first project by interns and student developers. This project’s primary goal is to bring less experienced developers up to speed on shop practices, while also providing a reasonably interesting and non-daunting problem for the new developer to solve.
The primary problem with this approach is that it isn’t immediately relevant to what’s being done in your group. Once finished, you’ll still have to go through and bring the dev up to speed on your project. Hopefully the active training will take slightly less time as you don’t have to go through and explain the major concepts. And hopefully they’ll be less likely to commit major sins, but it’s still not ideal. The ideal would probably be to bring the dev up to speed through pair programming, and slowly let them start working on their own / take control.
All that said; it might be just me that’s interested in this stuff. I like being able to go back and say ‘yes, the high for last week was 103 F; with a max wind speed of 20 mph’. I can foresee some developers being less enthusiastic about developing this system. However, for those actually interested, I think this would be a good learning experiment.
List of Side Projects
- Tron3D – Sometimes also called ‘light cycles game’. Basically the classic 2D light cycles game with an added dimension. Players move arround in 3-space, theoretically trying to end their enemies. In practice it’s more of a ’survive until they die’ kind of game, where all players start at opposite sides of a 10×10x10 cube. I’ve written this once with a networking component, as part of a one week game project for TAGD; but, the network play didn’t turn out well. I’d like to rewrite it, fix the networking flaw, and maybe add strange things to game play… like caverns/walls/a user interface.
- Tachyon RTS – Tachyon: The Fringe was a fun and enjoyable game from my better-forgot youth. In it, the player piloted a ship for one of various factions, theoretically for their sides ideals. It was akin to an arcade flight combat sim, with a fairly ‘deep’ story. I have that in quotes because I’m not sure if it was actually good, or if it was just a young mind captivated by the story, forming odd building blocks for a permanent fascination. But, irregaurdless of the psychological aspects, I’ve been curious for a long time to see it in RTS form: building up a mining base, or launching strikes from carriers, directing whole scale war efforts. It needs much more refinement, but I think it would make for an interesting project. That, and it would give me a chance to finally build a space based RTS (this side-desire is due to Conquest: Frontier Wars… another relatively awesome game from the days of old)
- Fix family websites. I ‘maintain’ two websites for family members (dad and brother). Both are abominations to good layout and design. Mostly because I’m not a layout person / web designer / graphically oriented fellow.
- Dungeon Builder / Viewer – Originating from D&D, and the dwarven forge tilesets used one or two times in my group. The first version of this would just be something for building multi-level dungeons, and viewing them in that high level of detail that comes from the dwarven forge tileset. In theory this would evolve into a more complex DM client, but I haven’t put that much thought into it yet.
- Tower of Simulation – Or better known as SimTower. I have no idea why, but I want to rewrite it.
- City of Simulation – Similar to Tower of Simulation; though for this one I think it’s more because I want to play around with the details of a complex simulation.
- Copter of Simulation – Just because the list seems incomplete without it. That, and the arcade-physics driven copter flight model meant I was actually capable of playing the game.
- Brothers Frac Pump Interface – Interfacing with a Frac Pump over a CAN-BUS. My brother is in the business of oilfield technology something or other. He’s built data cables, data vans, and is plotting to get into rewiring/servicing frac pumps. At least that’s how I understand it. He had the idea of developing a wireless tablet for the data vans for remote control of frac pumps. I’m not sure if it’ll ever see the light of day, but I’d like to do this for the whole ‘controlling something in the real world’ feel.
- Strange Flight Sim Thing – (The official name). What I actually want is to have the visual look and feel of EVE like combat (which is to say, space combat), with an indoor environment. Massive battles and dog fights and such within the 4 story open air portion of the Zachary building. Evading your pursuers by flying into an alcove and then through an open door. And so on. This is clearly doomed to fail as I have no 3d modelling ability, which comes to the next bit.
- Capture a 3d model from video of an environment. I have a sense this would be more of a thesis project; or, alternatively, that it’s already been done. I’m quite certain that it is technically ‘possible’ if the environment is static, and if the video does not contain impossible shapes/environments (looking at you, Picard); I just don’t know if its acheivable…
- Tao… thing – Envision for a second, a gnome. Of magely death and destruction. Now envision the gnome in a battle. Against Orcs. That make humans look small. Not so much a programming problem as a 3D animation and effects problem; but, if I were to ever develop artistic talent, and/or join the Viz Lab, this would be one of my projects.
- Taluva – A board game requiring either very little or very much skill. You’re building an island and several settlements; land consists of triangular hexagon groups (3 hexs), where 1 hex is a volcano, and two hexes are habitable land. There’s more to it then that, but the description suffices for now. It’s a straight forward game, made slightly more interesting by the fact that over the course of the game you are building a 3d model of an island.
- PowerGrid – Another board game. You play the part of a power company, connecting cities together, and buying power plants for powering said cities. Features an auction component and a whole lot of simple addition. I suspect, if I were to force my mind to it, this would make an alright project for an AI class; but it’s a bit more complex then I’d like… we’ll see.
- Linear Army Command – Not the best of descriptions; based on a game played on; I think it was a Mac, more then 10 years ago, in black and white if I recall correctly. or 16 colors, such are 10 year old memmories. Takes place on a 2d field of combat, you pilot a helicopter, and have the ability to pick up and parachute off troops, and buy tanks, APC’s, and rocket artillery, with which to take over command points, and eventually your horrible enemy’s base. I don’t remember all the specifics to it, but it was rather enjoyable, and would actually seem like a decent flash game, if it hasn’t already been made several thousand times; and if I ever learn flash. (I know I’ve seen similar versions, though you’re generally only an indirect factor, where as in this game you have the ability to personally demolish things).
UPDATE: Thanks to Jae, we now have name for the original game: Armor Alley, published in 1990… ish. - Deity vs Deity RTS- I blame this one on someone in TAGD; I think either Danny Dyer (Dier? Dyier? bah), or Jacob Beaudoin… or both. And possibly someone else. While comming back from an Austin Game Developer Conference/Meeting/thing, somehow the concept of a game where in you fight as (we’ll go with an angel) against demons, devils, and other bad and terribly things came up. I suspect they saw it as more an FPS or RPG, but I think it’d be interesting to take it to an RTS form. And I’m fairly certain this predated the odd South Park episode with a similar game concept. Almost certain.
- Online todo list/task system – When I remember to, I use tadalist for remembering things to do… like homework. The problem with tadalist, is it doesn’t provide an easy method of tracking when something needs to be done by. Or relative priority. I’d like to build yet another task list (called DragonTasks, but thats beside the point), to correct this horrible and grevious oversight on their part of providing the simplest todo list system possible. May also have something to do with a lack of desire to try other task systems.
- What I Remember. I go through a lot of life remembering random bits of the past. Some of these memories I’d like to continue remembering. Some I’d like to just have down so I can more clearly reflect on them. I’d like to setup a web app suitable for sitting down at and transcribing and inter-linking/inter-relating these thousands of events. In theory, and a bit more morbid, this could also be passed on to surviving family members; sort of a legacy of ‘these are the parts of my life that I remembered 15 years down the road’.
- Just a grab bag of whats left: RayCaster/RayTracer (probably do that in a computer graphics class though), RubyBat – the Ruby version of JavaBat, Moon/Mars/Space Tycoon- because the list isn’t unoriginal, or space based, enough yet; some form of FPS;
some form of MMO (I’d actually like to figure out how to do an MMORTS, but I have no idea how that could work); and a MUD. - NeHe tutorials- More of a side project, not even worthy of the grab bag; I’d like to go through all the NeHe tutorials to get my bearings in OpenGL again.
So, as we can see, I seem to have a fetish for 3D, Space, and RTS’s. And a large lack of originality.
When I first wrote this list (on paper), there were about 20 items. I’ve forgotten things. Very sad. When I remember I’ll probably just edit this post; so, be warned: this will change.
