Sunday, February 17, 2013

Boil an egg app - step by step (step 1 - planning)

     In this tutorial , I will demonstrate how I built the app, from the design, to the logic and the code itself. 
 
This app was written for educational purposes and is free do download on the market at : 
Boil An Egg  - for devices with API 1.6 and above.
 
unnamed
So what's the deal with this app?
 
it's main goal is to provide users with an easy and useful tool to boil an egg, sounds funny and a bit redundant, but for me it's actually a real need, for I'm known to make boiled eggs which are too soft, or on the other hand -too hard.
so I thought to myself that there's must be an app on the play store which will enable me to time the eggs so they'll be perfect each time.
 
After searching the market and installing couple of apps I found that they are too complicated for my needs so I decided to write an app for my own.
 
1. name for the app: simple is good – “Boil An Egg” 
    package name: because I work at Sela group, I wanted to   
    leverage this app for educational purposes so I used
    com.selagroup.boilanegg
 
2. basic detailed design"
    I wanted to include basic functionality, so it will have a choice between 3 egg sizes(small,   
    medium, large) and 2 egg types (soft,hard). Having this configuration I needed 3X2 lengths
    of cook times. so with some small calculations I figured:
final static int boilTimeHardLargeEgg = 600000; // 10 minutes
final static int boilTimeSoftLargeEgg = 300000; // 5 minutes
final static int boilTimeSoftMediumEgg = 200000; // 4 minutes
final static int boilTimeHardMediumEgg = 500000; // 9 minutes
final static int boilTimeSoftSmallEgg = 100000; // 1.5 minutes
final static int boilTimeHardSmallEgg = 250000; // 4+ minutes
many other apps offer some nifty calculations (egg temperature, humidity..GPS..) but I needed to keep it simple.
 
so the flow I went for has 3 simple steps – all happen in a single activity :
 
1. choose egg size
2. choose egg type
3. hit the start timer button
 
from now on, a timer will countdown until the eggs are ready and cooked, followed by a sound playing which lets the user know that his eggs are ready.
 
sounds simple right?
well, it is
 
once you plan a project and keep it simple, it works. of course that complicated projects should work as well, but for this impromptu app which was written in less than two hours give or take, it should suffice
 
in the next post, I’ll show the code used in the app, and how I planned it out, also it will display some nifty visual effects using gradients for a slick looking GUI.