以Program寫平常事
有見於本Blog近來缺乏IT Stuff,是以特此寫一篇Program(一篇Program…=_=)以形容小弟,又或是一眾IT人的日常生活…忙的辛苦的,可不止我一個呀。
// should be Singleton, there is only one ShawTim in the world, you cant create one
Pawn shawtim = Office.getSmallPotatoInstance("ShawTim");
// although I dont care anyway, suppose there is only one Boss in office
Boss heWhoCouldNotBeNamed = Office.getBoss("HeWhoCouldNotBeNamed");
// create a Project with tight schedule, actually this kind of stuff is everywhere on office
Project whatTheHellIsIt = new Project(ScheduleStatus.TIGHT);
// oh, PM is everywhere man! Just create one, give him a Project with tight schedule!
ProjectManager pm = new ProjectManager(whatTheHellIsIt);
// yo man, time to start working! so in what situation should ShawTim start to work?
while (heWhoCouldNotBeNamed.hasInnovativeIdea() || pm.hasProjectOnHand() || true) {
// oh shxt! ShawTim should work in ANY time! ShawTim is in panic!
shawtim.setStatus(Status.PANIC);
// so, PM needs to beg ShawTim to rush for the schedule
pm.beg(whatTheHellIsIt, shawtim, WorkMode.ENABLE_OVERTIME);
// ShawTim starts working!
while (!whatTheHellIsIt.isFinished()) {
while (shawtim.isStillAlive()) {
// Ignore day or night
shawtim.work(whatTheHellIsIt, WorkMode.IGNORE_DAY_NIGHT);
}
// sleep() means that ShawTim has implemented Runnable interface…
// that means ShawTim can handle work multi-threadingly
shawtim.sleep(Time.MINIMUM_SLEEPING_TIME);
// ShawTim revive with HP 1
shawtim.revive(1);
}
}
// ShawTim now can play everything and enjoy his happy life
shawtim.setStatus(Status.HAPPY);
shawtim.play();