Сţµç×ÓÊé > ÆäËûµç×ÓÊé > VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ) >

µÚ72ÕÂ

VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ)-µÚ72ÕÂ

С˵£º VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ) ×ÖÊý£º ÿҳ3500×Ö

°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡




problem£»¡¡but¡¡solves¡¡a¡¡problem¡¡relating¡¡to¡¡building¡¡the¡¡application¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡Another¡¡purpose¡¡of¡¡this¡¡chapter¡¡is¡¡to¡¡give¡¡you¡¡more¡¡experience¡¡with¡¡developing¡¡ponent

oriented¡¡code¡£¡¡In¡¡particular£»¡¡you¡¯ll¡¡learn¡¡how¡¡to¡¡develop¡¡a¡¡kernel¡£¡¡Developing¡¡a¡¡kernel¡¡demon

strates¡¡the¡¡power¡¡and¡¡flexibility¡¡of¡¡the¡¡ponent¡­oriented¡¡development¡¡approach¡£¡¡You¡¡can¡¡¡¡

build¡¡a¡¡working¡¡system¡¡even¡¡though¡¡you¡¡might¡¡not¡¡know¡¡what¡¡all¡¡of¡¡the¡¡implementations¡¡are¡¡¡¡

ahead¡¡of¡¡time¡£¡¡This¡¡type¡¡of¡¡development¡¡makes¡¡it¡¡possible¡¡to¡¡modularize¡¡development£»¡¡in¡¡that¡¡¡¡

individual¡¡teams¡¡are¡¡responsible¡¡for¡¡certain¡¡interfaces¡£¡¡Then¡¡once¡¡the¡¡pieces¡¡have¡¡been¡¡imple

mented£»¡¡they¡¡are¡¡fitted¡¡together¡¡like¡¡a¡¡jigsaw¡¡puzzle¡£¡¡Of¡¡course£»¡¡interfaces¡¡and¡¡ponents¡¡do¡¡¡¡

not¡¡guarantee¡¡success£»¡¡but¡¡they¡¡do¡¡ensure¡¡one¡¡team¡¡does¡¡not¡¡need¡¡to¡¡wait¡¡for¡¡another¡¡team¡¡to¡¡¡¡

finish¡¡its¡¡code¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡To¡¡demonstrate¡¡all¡¡of¡¡these¡¡concepts£»¡¡we¡¯ll¡¡build¡¡an¡¡application¡¡that¡¡controls¡¡lighting¡¡in¡¡¡¡

buildings£»¡¡using¡¡the¡¡kernel¡¡programming¡¡approach¡£¡¡



Understanding¡¡Kernels¡¡



Imagine¡¡you¡¡are¡¡the¡¡owner¡¡of¡¡a¡¡house¡¡or¡¡mercial¡¡building£»¡¡and¡¡you¡¡want¡¡to¡¡reduce¡¡your¡¡¡¡

electricity¡¡bill¡£¡¡One¡¡way¡¡of¡¡doing¡¡that¡¡is¡¡to¡¡automate¡¡the¡¡lighting¡¡system¡¡of¡¡your¡¡building¡¡so¡¡that¡¡¡¡

lights¡¡are¡¡on¡¡when¡¡they¡¡need¡¡to¡¡be¡£¡¡What¡¡is¡¡unique¡¡about¡¡this¡¡system¡¡is¡¡that¡¡you¡¡have¡¡a¡¡controller¡¡¡¡

and¡¡the¡¡devices¡¡that¡¡are¡¡controlled¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡The¡¡controller¡¡controls¡¡devices¡¡that¡¡it¡¡does¡¡not¡¡know¡¡about¡¡ahead¡¡of¡¡time£»¡¡but¡¡fulfills¡¡a¡¡¡¡

contract¡£¡¡The¡¡lighting¡¡system¡¡is¡¡a¡¡controller£»¡¡programmatically¡¡called¡¡a¡¡kernel£»¡¡because¡¡the¡¡¡¡

rooms¡¡that¡¡it¡¡controls¡¡are¡¡not¡¡known¡¡initially¡£¡¡The¡¡rooms¡¡are¡¡known¡¡when¡¡the¡¡controller¡¡is¡¡used¡¡¡¡

to¡¡manage¡¡the¡¡lighting¡¡system¡£¡¡The¡¡kernel¡¡programming¡¡approach¡¡is¡¡one¡¡where¡¡a¡¡core¡¡of¡¡func

tionality¡¡is¡¡developed¡£¡¡The¡¡core¡¡functionality¡¡by¡¡itself¡¡does¡¡not¡¡work£»¡¡because¡¡it¡¡relies¡¡on¡¡other¡¡¡¡

pieces¡¡to¡¡perform¡¡certain¡¡tasks¡£¡¡In¡¡programming¡¡terms£»¡¡this¡¡is¡¡called¡¡developing¡¡ponents¡¡¡¡

that¡¡use¡¡interfaces¡¡and¡¡implementations¡£¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡197¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡220¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

198¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡8¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡A¡¡R¡¡N¡¡IN¡¡G¡¡¡¡¡¡AB¡¡OU¡¡T¡¡¡¡¡¡CO¡¡M¡¡P¡¡O¡¡N¡¡E¡¡N¡¡TO¡¡R¡¡IE¡¡N¡¡T¡¡E¡¡D¡¡¡¡AR¡¡C¡¡HI¡¡TE¡¡CT¡¡U¡¡R¡¡E¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ponents¡¡are¡¡implemented¡¡at¡¡the¡¡technical¡¡level¡¡using¡¡interfaces¡¡and¡¡classes¡¡that¡¡subclass¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡interfaces¡£¡¡The¡¡interface¡¡represents¡¡an¡¡idea£»¡¡and¡¡the¡¡classes¡¡represent¡¡the¡¡implementation¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡of¡¡an¡¡idea¡£¡¡A¡¡class¡¡could¡¡implement¡¡multiple¡¡interfaces£»¡¡where¡¡each¡¡interface¡¡represents¡¡a¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡unique¡¡characteristic¡¡of¡¡the¡¡class¡¡implementation¡£¡¡Ideas¡¡and¡¡interfaces¡¡also¡¡represent¡¡contracts¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡or¡¡standards¡£¡¡The¡¡kernel¡¡defines¡¡a¡¡standard£»¡¡and¡¡the¡¡ponent¡¡has¡¡the¡¡responsibility¡¡of¡¡imple

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡menting¡¡that¡¡standard¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Implementing¡¡a¡¡kernel¡¡is¡¡like¡¡being¡¡a¡¡coach¡£¡¡A¡¡coach¡¡thinks¡¡of¡¡where¡¡to¡¡place¡¡players¡¡in¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡field¡¡and¡¡develops¡¡strategies¡¡that¡¡the¡¡players¡¡need¡¡to¡¡implement¡£¡¡But¡¡on¡¡game¡¡day£»¡¡the¡¡players¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡will¡¡do¡¡what¡¡they¡¡think¡¡is¡¡best£»¡¡and¡¡the¡¡coach¡¡is¡¡powerless¡£¡¡A¡¡coach¡¡can¡¡teach¡¡the¡¡players£»¡¡but¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡whether¡¡they¡¡apply¡¡that¡¡knowledge¡¡is¡¡up¡¡to¡¡the¡¡individual¡¡players¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡In¡¡programming¡¡terms£»¡¡the¡¡kernel¡¡is¡¡the¡¡coach£»¡¡and¡¡the¡¡external¡¡implementations¡¡to¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡manipulate¡¡are¡¡the¡¡players¡£¡¡When¡¡designing¡¡interfaces¡¡that¡¡other¡¡pieces¡¡of¡¡functionality¡¡will¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡implement£»¡¡you¡¡cannot¡¡watch¡¡over¡¡the¡¡shoulders¡¡of¡¡the¡¡programmers¡¡and¡¡make¡¡sure¡¡they¡¡do¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡things¡¡correctly¡£¡¡You¡¡need¡¡to¡¡trust£»¡¡but¡¡you¡¡also¡¡need¡¡to¡¡implement¡¡a¡¡mode¡¡of¡¡programming¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡where¡¡you¡¡assume¡¡the¡¡programmers¡¡are¡¡going¡¡to¡¡do¡¡things¡¡incorrectly¡£¡¡This¡¡has¡¡nothing¡¡to¡¡do¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡with¡¡the¡¡personal¡¡abilities¡¡of¡¡the¡¡other¡¡programmers¡£¡¡It¡¡has¡¡to¡¡do¡¡with¡¡the¡¡ability¡¡to¡¡make¡¡sure¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡your¡¡kernel¡¡continues¡¡functioning£»¡¡even¡¡when¡¡someone¡¡makes¡¡a¡¡mistake¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Remember¡¡that¡¡when¡¡implementing¡¡a¡¡kernel£»¡¡you¡¡are¡¡implementing¡¡a¡¡controller£»¡¡and¡¡you¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡are¡¡devising¡¡the¡¡strategy¡¡of¡¡the¡¡application¡£¡¡You¡¡are¡¡just¡¡not¡¡doing¡¡all¡¡of¡¡the¡¡implementations¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡When¡¡you¡¡write¡¡production¡¡code£»¡¡and¡¡you¡¡have¡¡been¡¡put¡¡in¡¡charge¡¡of¡¡writing¡¡a¡¡kernel£»¡¡count¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡yourself¡¡lucky¡£¡¡But¡¡remember¡¡with¡¡the¡¡job¡¡of¡¡building¡¡a¡¡kernel¡¡es¡¡great¡¡responsibility¡£¡¡If¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡your¡¡kernel¡¡is¡¡buggy¡¡or¡¡badly¡¡designed£»¡¡then¡¡the¡¡external¡¡implementations¡¡will¡¡also¡¡be¡¡buggy¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡and¡¡potentially¡¡badly¡¡designed¡£¡¡The¡¡kernel¡¡is¡¡the¡¡rock¡¡and¡¡foundation¡¡of¡¡the¡¡application¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Organizing¡¡the¡¡Lighting¡¡Application¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡For¡¡the¡¡moment£»¡¡imagine¡¡we¡¡are¡¡not¡¡developing¡¡software£»¡¡but¡¡actually¡¡building¡¡a¡¡house¡£¡¡And¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡in¡¡this¡¡house£»¡¡we¡¡are¡¡going¡¡to¡¡add¡¡a¡¡central¡¡lighting¡¡system¡£¡¡The¡¡make¡¡of¡¡light¡¡bulbs£»¡¡lamps£»¡¡and¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡lighting¡¡controller¡¡are¡¡not¡¡identical¡£¡¡This¡¡is¡¡interesting¡¡in¡¡that¡¡multiple¡¡panies¡¡make¡¡prod

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ucts¡¡that¡¡work¡¡with¡¡each¡¡other¡¯s¡¡device£»¡¡because¡¡all¡¡panies¡¡adhere¡¡to¡¡a¡¡particular¡¡standard¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡process¡¡of¡¡standardization¡¡is¡¡all¡¡around¡¡us£»¡¡and¡¡is¡¡as¡¡simple¡¡as¡¡the¡¡electricity¡¡that¡¡es¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡out¡¡of¡¡our¡¡electrical¡¡outlets¡£¡¡However£»¡¡what¡¡is¡¡a¡¡standard¡¡in¡¡one¡¡country¡¡is¡¡not¡¡necessarily¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡standard¡¡in¡¡another¡¡country¡£¡¡Different¡¡countries¡¡will¡¡have¡¡different¡¡standard¡¡voltages¡£¡¡In¡¡terms¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡of¡¡software£»¡¡the¡¡kernel¡¡represents¡¡a¡¡standard¡¡that¡¡allows¡¡the¡¡integration¡¡of¡¡ponents¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡lighting¡¡application¡¡will¡¡include¡¡these¡¡features£º¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡A¡¡room¡¡where¡¡the¡¡light¡¡can¡¡be¡¡controlled¡¡using¡¡either¡¡a¡¡simple¡¡on/off¡¡switch¡¡or¡¡a¡¡gradual¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡light¡­intensity¡¡mechanism¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡The¡¡controller¡¡represents¡¡a¡¡building£»¡¡and¡¡the¡¡rooms¡¡within¡¡the¡¡building¡¡can¡¡be¡¡grouped£»¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡making¡¡it¡¡simpler¡¡to¡¡perform¡¡group¡¡operations¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Rooms¡¡are¡¡associated¡¡with¡¡identifiers¡¡that¡¡allow¡¡each¡¡room¡¡to¡¡be¡¡isolated¡¡individually¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Rooms¡¡can¡¡be¡¡associated¡¡with¡¡a¡¡set¡¡of¡¡attributes¡¡that¡¡indicate¡¡the¡¡behavior¡¡they¡¡do¡¡and¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡do¡¡not¡¡support¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡221¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡C¡¡H¡¡AP¡¡TE¡¡R¡¡¡¡¡¡8¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡AR¡¡N¡¡IN¡¡G¡¡¡¡¡¡AB¡¡O¡¡U¡¡T¡¡¡¡¡¡CO¡¡M¡¡P¡¡O¡¡N¡¡E¡¡N¡¡T¡¡O¡¡R¡¡IE¡¡N¡¡TE¡¡D¡¡¡¡¡¡A¡¡R¡¡CH¡¡I¡¡TE¡¡C¡¡TU¡¡R¡¡E¡¡199¡¡



¡¡¡¡¡¡¡¡¡¡The¡¡source¡¡code¡¡will¡¡implement¡¡the¡¡controller¡¡as¡¡a¡¡library¡¡project¡¡named¡¡¡¡LibLightingSystem¡£¡¡¡¡

This¡¡library¡¡project¡¡will¡¡also¡¡define¡¡the¡¡interfaces¡¡that¡¡the¡¡ponents¡¡will¡¡implement¡£¡¡To¡¡¡¡

demonstrate¡¡building¡¡a¡¡plete¡¡working¡¡application£»¡¡two¡¡other¡¡projects¡¡implement¡¡the¡¡inter

faces¡¡and¡¡represent¡¡ponents£º¡¡Museum¡¡and¡¡Home¡£¡¡The¡¡key¡¡characteristics¡¡of¡¡a¡¡museum¡¡are¡¡that¡¡¡¡

some¡¡rooms¡¡are¡¡made¡¡dark¡¡at¡¡night¡¡and¡¡are¡¡pletely¡¡managed¡¡by¡¡the¡¡controller£»¡¡while¡¡other¡¡¡¡

rooms¡¡are¡¡controlled¡¡individually¡¡in¡¡the¡¡room¡¡itself¡¡and¡¡also¡¡can¡¡be¡¡managed¡¡by¡¡the¡¡controller¡£¡¡¡¡

The¡¡key¡¡characteristics¡¡of¡¡a¡¡home¡¡are¡¡that¡¡all¡¡of¡¡the¡¡rooms¡¡are¡¡individually¡¡controlled£»¡¡but¡¡they¡¡¡¡

have¡¡sensors¡¡that¡¡allow¡¡automatic¡¡control¡£¡¡Some¡¡of¡¡the¡¡lighting¡¡associated¡¡with¡¡the¡¡house¡¡depends¡¡¡¡

on¡¡certain¡¡prerequisites¡¡being¡¡fulfilled¡£¡¡For¡¡example£»¡¡night¡­lights¡¡might¡¡turn¡¡on¡¡depending¡¡on¡¡¡¡

the¡¡time¡¡of¡¡year£»¡¡or¡¡room¡¡lights¡¡might¡¡be¡¡turned¡¡on¡¡and¡¡off¡¡automatically¡¡when¡¡no¡¡one¡¡is¡¡home¡£¡¡¡¡

As¡¡usual£»¡¡we¡¡will¡¡use¡¡a¡¡testing¡¡console¡¡application£»¡¡named¡¡TestLightingSystem£»¡¡to¡¡test¡¡the¡¡three¡¡¡¡

assemblies¡¡£¨it¡¡is¡¡the¡¡startup¡¡project£©¡£¡¡Figure¡¡8¡­1¡¡shows¡¡the¡¡project¡¡structure¡£¡¡



Figure¡¡8¡­1¡£¡¡Lighting¡¡system¡¡application¡¡project¡¡structure¡¡



Building¡¡the¡¡Kernel¡¡



The¡¡lighting¡¡system¡¡is¡¡a¡¡two¡­part¡¡implementation¡£¡¡The¡¡first¡¡part¡¡is¡¡that¡¡we¡¡must¡¡write¡¡code¡¡that¡¡¡¡

works¡¡properly¡£¡¡The¡¡second¡¡part¡¡is¡¡to¡¡integrate¡¡code¡¡that¡¡someone¡¡else¡¡has¡¡written¡¡and¡¡make¡¡¡¡

sure¡¡that¡¡if¡¡that¡¡code¡¡does¡¡not¡¡work¡¡properly¡¡for¡¡some¡¡reason£»¡¡those¡¡problems¡¡will¡¡not¡¡affect¡¡the¡¡¡¡

code¡¡that¡¡we¡¡wrote¡£¡¡

¡¡¡¡¡¡¡¡¡¡This¡¡application¡¡is¡¡plicated¡¡by¡¡the¡¡fact¡¡that¡¡we¡¡are¡¡dealing¡¡with¡¡the¡¡unknown¡£¡¡In¡¡the¡¡¡¡

previous¡¡examples£»¡¡we¡¡had¡¡control¡¡of¡¡

·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨2£© ²È£¨2£©

Äã¿ÉÄÜϲ»¶µÄ