ÓÑÇéÌáʾ£ºÈç¹û±¾ÍøÒ³´ò¿ªÌ«Âý»òÏÔʾ²»ÍêÕû£¬Çë³¢ÊÔÊó±êÓÒ¼ü¡°Ë¢Ð¡±±¾ÍøÒ³£¡
¸»Ê¿¿µÐ¡ËµÍø ·µ»Ø±¾ÊéĿ¼ ¼ÓÈëÊéÇ© ÎÒµÄÊé¼Ü ÎÒµÄÊéÇ© TXTÈ«±¾ÏÂÔØ ¡ºÊղص½ÎÒµÄä¯ÀÀÆ÷¡»

VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ)-µÚ39²¿·Ö

¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿! Èç¹û±¾ÊéûÓÐÔĶÁÍ꣬ÏëÏ´μÌÐø½Ó×ÅÔĶÁ£¬¿ÉʹÓÃÉÏ·½ "Êղص½ÎÒµÄä¯ÀÀÆ÷" ¹¦ÄÜ ºÍ "¼ÓÈëÊéÇ©" ¹¦ÄÜ£¡




¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡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¡¡every¡¡class£»¡¡interface£»¡¡and¡¡definition¡£¡¡This¡¡time£»¡¡we¡¡are¡¡¡¡

not¡¡in¡¡control£»¡¡and¡¡thus¡¡we¡¡need¡¡to¡¡use¡¡a¡¡defensive¡¡style¡¡of¡¡programming¡£¡¡This¡¡means¡¡we¡¡need¡¡¡¡

to¡¡write¡¡many¡¡tests¡¡and¡¡keep¡¡certain¡¡information¡¡private¡£¡¡¡¡



Defining¡¡the¡¡Interfaces¡¡



The¡¡core¡¡of¡¡the¡¡lighting¡¡controller¡¡is¡¡to¡¡control¡¡the¡¡lighting¡¡in¡¡a¡¡room¡¡that¡¡is¡¡part¡¡of¡¡the¡¡building¡£¡¡¡¡

We¡¡can¡¡define¡¡and¡¡organize¡¡the¡¡rooms¡¡by¡¡using¡¡interfaces¡£¡¡We¡¡need¡¡four¡¡interfaces£º¡¡¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡IRoom£º¡¡A¡¡placeholder¡¡interface¡¡for¡¡the¡¡idea¡¡of¡¡a¡¡room¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡INoRemoteControlRoom£º¡¡An¡¡interface¡¡for¡¡rooms¡¡that¡¡should¡¡not¡¡be¡¡controlled¡¡by¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡lighting¡¡controller¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡IRemoteControlRoom£º¡¡An¡¡interface¡¡for¡¡rooms¡¡that¡¡should¡¡be¡¡pletely¡¡controlled¡¡by¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡lighting¡¡controller¡¡



¡¡¡¡¡¡¡¡¡¡o¡¡¡¡ISensorRoom£º¡¡An¡¡interface¡¡for¡¡rooms¡¡whose¡¡control¡¡is¡¡based¡¡on¡¡state¡¡£¨whether¡¡or¡¡not¡¡a¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡person¡¡is¡¡in¡¡the¡¡room£©¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡222¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

200¡¡¡¡¡¡¡¡¡¡¡¡¡¡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¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡interfaces¡¡for¡¡the¡¡rooms¡¡where¡¡lighting¡¡may¡¡be¡¡controlled£»¡¡IRemoteControlRoom¡¡and¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ISensorRoom£»¡¡will¡¡depend¡¡on¡¡certain¡¡pieces¡¡of¡¡logic¡£¡¡The¡¡interfaces¡¡will¡¡need¡¡to¡¡provide¡¡input¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡data¡¡and¡¡accept¡¡output¡¡data¡£¡¡The¡¡logic¡¡might¡¡also¡¡seek¡¡input¡¡from¡¡other¡¡sources£»¡¡such¡¡as¡¡time¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡of¡¡day¡¡or¡¡amount¡¡of¡¡sunlight¡¡outdoors¡£¡¡It¡¡boils¡¡down¡¡to¡¡defining¡¡some¡¡type¡¡of¡¡logic¡¡that¡¡the¡¡kernel¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡implements¡£¡¡This¡¡is¡¡key£»¡¡and¡¡it¡¡relates¡¡to¡¡the¡¡children¡­and¡­parent¡¡issue¡£¡¡While¡¡you¡¡accept¡¡your¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡children¡¡as¡¡being¡¡intelligent¡¡beings¡¡that¡¡can¡¡make¡¡decisions£»¡¡at¡¡the¡¡end¡¡of¡¡the¡¡day£»¡¡it¡¡is¡¡usually¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡parent¡¡who¡¡makes¡¡the¡¡final¡¡decisions¡£¡¡Likewise£»¡¡while¡¡your¡¡kernel¡¡might¡¡accept¡¡input¡¡and¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡potential¡¡decisions£»¡¡the¡¡kernel¡¡makes¡¡the¡¡final¡¡decisions¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Defining¡¡IRoom£»¡¡a¡¡Placeholder¡¡Interface¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡For¡¡design¡¡purposes£»¡¡the¡¡simplest¡¡and¡¡base¡¡idea¡¡is¡¡the¡¡room¡¡itself£»¡¡which¡¡can¡¡be¡¡defined¡¡as¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡follows¡¡£¨in¡¡the¡¡controller¡¡library¡¡¡¡LibLightingSystem£©£º¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Public¡¡Interface¡¡IRoom¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Interface¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡interface¡¡does¡¡not¡¡have¡¡any¡¡methods¡¡or¡¡properties¡£¡¡It¡¡is¡¡called¡¡a¡¡placeholder¡¡interface¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡A¡¡placeholder¡¡type¡¡serves¡¡no¡¡other¡¡purpose¡¡than¡¡identifying¡¡that¡¡the¡¡implementation¡¡is¡¡of¡¡a¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡certain¡¡type¡£¡¡Placeholder¡¡interfaces¡¡make¡¡it¡¡simpler¡¡to¡¡group¡¡objects¡¡that¡¡have¡¡certain¡¡capabilities¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Imagine¡¡defining¡¡objects¡¡without¡¡a¡¡placeholder¡¡interface£»¡¡something¡¡like¡¡this£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Class¡¡Type1¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Class¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Class¡¡Type2¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Class¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Looking¡¡at¡¡Type1¡¡and¡¡Type2£»¡¡you¡¡cannot¡¡see¡¡any¡¡correlation¡¡between¡¡the¡¡two¡¡types£»¡¡there¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡is¡¡no¡¡way¡¡to¡¡say¡¡that¡¡Type1¡¡and¡¡Type2¡¡have¡¡anything¡¡in¡¡mon¡£¡¡£¨Well£»¡¡technically¡¡there¡¡is¡¡a¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡correlation¡¡in¡¡that¡¡both¡¡types¡¡are¡¡derived¡¡from¡¡Object£»¡¡but¡¡that¡¡type¡¡of¡¡correlation¡¡is¡¡like¡¡saying¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡that¡¡all¡¡people¡¡are¡¡humans¡££©¡¡Using¡¡a¡¡placeholder¡¡interface£»¡¡Type1¡¡and¡¡Type2¡¡can¡¡be¡¡correlated£»¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡as¡¡follows£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Class¡¡Type1¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Implements¡¡IRoom¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Class¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Class¡¡Type2¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Implements¡¡IRoom¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡End¡¡Class¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¡¡¡£¡¡¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Dim¡¡rooms¡¡As¡¡IRoom£¨£©¡¡=¡¡New¡¡IRoom£¨£©¡¡£ûNew¡¡Type1£¨£©£»¡¡New¡¡Type2£¨£©£ý¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Having¡¡Type1¡¡and¡¡Type2¡¡implement¡¡the¡¡¡¡IRoom¡¡interface£»¡¡which¡¡means¡¡do¡¡nothing¡¡other¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡than¡¡subclass¡¡IRoom£»¡¡establishes¡¡a¡¡correlation¡¡between¡¡Type1¡¡and¡¡Type2¡£¡¡The¡¡correlation¡¡is¡¡that¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡both¡¡Type1¡¡and¡¡Type2¡¡are¡¡rooms¡£¡¡We¡¡have¡¡no¡¡idea¡¡what¡¡kind¡¡of¡¡rooms£»¡¡and¡¡we¡¡have¡¡no¡¡idea¡¡if¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡rooms¡¡are¡¡in¡¡the¡¡same¡¡building¡£¡¡We¡¡only¡¡know¡¡that¡¡they¡¡are¡¡rooms¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡use¡¡of¡¡placeholder¡¡interfaces¡¡is¡¡very¡¡important¡¡in¡¡kernel¡¡design¡£¡¡Placeholders¡¡estab

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡lish¡¡that¡¡a¡¡type¡¡wants¡¡to¡¡be¡¡part¡¡of¡¡a¡¡grouping¡£¡¡The¡¡kernel¡¡can¡¡use¡¡that¡¡grouping¡¡to¡¡define¡¡a¡¡list¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡of¡¡elements¡¡that¡¡are¡¡all¡¡similar¡£¡¡It¡¡is¡¡like¡¡knowing¡¡the¡¡age¡¡of¡¡people¡¡to¡¡determine¡¡whether¡¡they¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡are¡¡eligible¡¡to¡¡drive¡£¡¡The¡¡age¡¡does¡¡not¡¡indicate¡¡the¡¡sex¡¡or¡¡intelligence£»¡¡nor¡¡if¡¡they¡¡are¡¡good¡¡or¡¡bad¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡223¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡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¡¡201¡¡



drivers¡£¡¡The¡¡age¡¡is¡¡a¡¡placeholder¡¡that¡¡says£»¡¡¡°Yes¡¡you¡¡are¡¡part¡¡of¡¡a¡¡grouping¡¡that¡¡is¡¡allowed¡¡to¡¡take¡¡¡¡

a¡¡driving¡¡test¡¡to¡¡give¡¡you¡¡the¡¡right¡¡to¡¡drive¡£¡±¡¡

¡¡¡¡¡¡¡¡¡¡In¡¡the¡¡case¡¡of¡¡our¡¡lighting¡¡control£»¡¡defining¡¡the¡¡¡¡IRoom¡¡placeholder¡¡interface¡¡is¡¡saying¡¡that¡¡¡¡

whatever¡¡instance¡¡is¡¡associated¡¡with¡¡IRoom¡¡is¡¡indicating¡¡its¡¡interest¡¡in¡¡being¡¡part¡¡of¡¡the¡¡lighting¡¡¡¡

controller¡¡kernel¡£¡¡When¡¡you¡¡have¡¡identified¡¡a¡¡type¡¡using¡¡a¡¡placeholder¡¡interface£»¡¡you¡¡are¡¡saying¡¡¡¡

your¡¡type¡¡can¡¡be¡¡used¡¡in¡¡a¡¡certain¡¡context¡£¡¡The¡¡context¡¡is¡¡determined¡¡by¡¡the¡¡placeholder¡¡¡¡

interface¡£¡¡



Defining¡¡the¡¡INoRemoteControlRoom¡¡Interface¡¡



Although¡¡the¡¡purpose¡¡of¡¡the¡¡lighting¡¡system¡¡is¡¡to¡¡control¡¡the¡¡lighting£»¡¡some¡¡rooms¡¡should¡¡not¡¡¡¡

be¡¡controlled¡¡by¡¡the¡¡system¡£¡¡Perhaps¡¡the¡¡room¡¡is¡¡private£»¡¡or¡¡controlling¡¡its¡¡lighting¡¡would¡¡cause¡¡¡¡

problems¡£¡¡

¡¡¡¡¡¡¡¡¡¡For¡¡example£»¡¡should¡¡a¡¡bedroom¡¡in¡¡a¡¡house¡¡be¡¡controlled¡¡by¡¡the¡¡lighting¡¡controller£¿¡¡If¡¡the¡¡¡¡

lighting¡¡controller¡¡controls¡¡the¡¡lighting¡¡in¡¡the¡¡bedroom£»¡¡it¡¡might¡¡turn¡¡off¡¡the¡¡lights¡¡while¡¡a¡¡person¡¡is¡¡¡¡

reading¡£¡¡Or¡¡maybe¡¡it¡¡will¡¡turn¡¡on¡¡the¡¡lights¡¡when¡¡the¡¡person¡¡has¡¡decided¡¡to¡¡sleep¡¡in¡£¡¡Of¡¡course£»¡¡¡¡

the¡¡person¡¡could¡¡just¡¡switch¡¡the¡¡light¡¡on¡¡or¡¡off¡¡manually£»¡¡but¡¡that¡¡is¡¡disruptive¡£¡¡The¡¡inconve

nience¡¡of¡¡the¡¡controller¡¡getting¡¡it¡¡wrong¡¡outweighs¡¡the¡¡benefit¡¡of¡¡the¡¡controller¡¡getting¡¡it¡¡right£»¡¡¡¡

so¡¡the¡¡controller¡¡should¡¡not¡¡deal¡¡with¡¡this¡¡room¡£¡¡

¡¡¡¡¡¡¡¡¡¡The¡¡definition¡¡of¡¡an¡¡interface¡¡that¡¡indicates¡¡that¡¡the¡¡controller¡¡should¡¡do¡¡nothing¡¡is¡¡as¡¡¡¡

follows¡¡£¨in¡¡the¡¡controller¡¡library¡¡¡¡LibLightingSystem£©£º¡¡



Public¡¡Interface¡¡INoRemoteControlRoom¡¡

¡¡¡¡¡¡¡¡Inherits¡¡IRoom¡¡

End¡¡Interface¡¡



¡¡¡¡¡¡¡¡¡¡As¡¡you¡¡can¡¡see£»¡¡¡¡INoRemoteControlRoom¡¡lacks¡¡methods¡¡and¡¡properties£»¡¡like¡¡our¡¡placeholder¡¡¡¡

interface¡¡IRoom¡£¡¡However£»¡¡in¡¡this¡¡case£»¡¡there¡¡are¡¡no¡¡methods¡¡or¡¡properties¡¡because¡¡the¡¡kernel¡¡¡¡

system¡¡does¡¡not¡¡require¡¡them¡£¡¡The¡¡idea¡¡behind¡¡the¡¡INoRemoteControlRoom¡¡interface¡¡is¡¡to¡¡indicate¡¡¡¡

that¡¡the¡¡type¡¡implementing¡¡the¡¡interface¡¡is¡¡a¡¡room£»¡¡but¡¡a¡¡room¡¡that¡¡should¡¡not¡¡be¡¡managed¡¡by¡¡¡¡

the¡¡controller¡£¡¡Using¡¡the¡¡bedroom¡¡as¡¡an¡¡example£»¡¡the¡¡implementation¡¡is¡¡as¡¡follows¡¡£¨defined¡¡in¡¡¡¡

the¡¡Home¡¡project£©£º¡¡



¡¡¡¡¡¡¡¡Imports¡¡LibLightingSystem¡¡

¡¡¡¡¡¡¡¡Public¡¡Class¡¡Bedroom¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Implements¡¡INoRemoteControlRoom¡¡

¡¡¡¡¡¡¡¡End¡¡Class¡¡



¡¡¡¡¡¡¡¡¡¡The¡¡definition¡¡of¡¡the¡¡bedroom¡¡allows¡¡the¡¡kernel¡¡to¡¡use¡¡an¡¡instance¡¡of¡¡a¡¡room£»¡¡as¡¡follows£º¡¡



Dim¡¡rooms¡¡As¡¡IRoom£¨£©=¡¡New¡¡IRoom£¨10£©¡¡£û¡¡£ý¡¡

rooms£¨0£©¡¡=¡¡New¡¡Bedroom£¨£©¡¡

¡¡¡£¡¡¡£¡¡¡£¡¡



If¡¡TypeOf£¨rooms£¨0£©£©¡¡Is¡¡INoRemoteControlRoom¡¡Then¡¡

¡¡¡¡¡¡¡¡'¡¡Take¡¡appropriate¡¡action¡¡

End¡¡If¡¡



¡¡¡¡¡¡¡¡¡¡This¡¡code¡¡creates¡¡an¡¡array¡¡of¡¡rooms¡¡and¡¡assigns¡¡the¡¡index¡¡0¡¡to¡¡an¡¡instance¡¡of¡¡Bedroom¡£¡¡The¡¡¡¡

If¡¡statement¡¡asks¡¡if¡¡the¡¡¡¡IRoom¡¡instance¡¡in¡¡index¡¡0¡¡is¡¡of¡¡type¡¡INoRemoteControlRoom¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡224¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

202¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡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¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡öNote¡¡¡¡Using¡¡placeholder¡¡interfaces¡¡and¡¡inheritance¡¡sets¡¡up¡¡a¡¡very¡¡powerful¡¡architecture¡¡that¡¡allows¡¡you¡¡to¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡create¡¡groupings¡£¡¡You¡¡can¡¡then¡¡filter¡¡individual¡¡instances¡¡based¡¡on¡¡refinements¡¡of¡¡the¡¡grouping¡£¡¡All¡¡of¡¡this¡¡is¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡possible¡¡in¡¡the¡¡Visual¡¡Basic¡¡language¡¡using¡¡TryCast£¨£©¡¡and¡¡Is£»¡¡which¡¡allow¡¡queries¡¡of¡¡subclassed¡¡types¡¡of¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡an¡¡instance¡£¡¡The¡¡queries¡¡are¡¡noninvasive¡¡and¡¡do¡¡not¡¡cause¡¡exceptions¡¡to¡¡be¡¡thrown¡£¡¡The¡¡queries¡¡give¡¡you¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ability¡¡to¡¡make¡¡decisions¡¡based¡¡on¡¡whether¡¡an¡¡instance¡¡would¡¡like¡¡to¡¡be¡¡associated¡¡with¡¡a¡¡particular¡¡grouping¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡based¡¡on¡¡an¡¡interface¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Defining¡¡the¡¡IRemoteControlRoom¡¡Interface¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Another¡¡type¡¡of¡¡room¡¡is¡¡one¡¡where¡¡the¡¡lighting¡¡is¡¡pletely¡¡managed¡¡by¡¡the¡¡controller¡£¡¡The¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡controller¡¡does¡¡not¡¡seek¡¡the¡¡input¡¡of¡¡the¡¡room¡¡and¡¡manages¡¡the¡¡lighting¡¡based¡¡on¡¡the¡¡logic¡¡that¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡seems¡¡appropriate¡¡to¡¡it¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡For¡¡example£»¡¡a¡¡public¡­viewing¡¡area¡¡in¡¡a¡¡museum¡¡does¡¡not¡¡require¡¡light¡¡at¡¡certain¡¡times¡¡of¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡day¡£¡¡When¡¡the¡¡museum¡¡is¡¡closed¡¡and¡¡the¡¡cleaners¡¡are¡¡finished£»¡¡the¡¡lights¡¡can¡¡be¡¡turned¡¡off¡£¡¡When¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡museum¡¡is¡¡open£»¡¡the¡¡lights¡¡are¡¡turned¡¡on¡£¡¡This¡¡is¡¡a¡¡simple¡¡logic¡¡and¡¡can¡¡be¡¡pletely¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡managed¡¡by¡¡the¡¡controller¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡interface¡¡for¡¡the¡¡controlled¡¡room¡¡is¡¡defined¡¡as¡¡follows¡¡£¨in¡¡¡¡LibLightingSystem£©£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Public¡¡Interface¡¡IRemoteControlRoom¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Inherits¡¡IRoom¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨11£© ²È£¨11£©
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿!
ÎÂÜ°Ìáʾ£º ο´Ð¡ËµµÄͬʱ·¢±íÆÀÂÛ£¬Ëµ³ö×Ô¼ºµÄ¿´·¨ºÍÆäËüС»ï°éÃÇ·ÖÏíÒ²²»´íŶ£¡·¢±íÊéÆÀ»¹¿ÉÒÔ»ñµÃ»ý·ÖºÍ¾­Ñé½±Àø£¬ÈÏÕæдԭ´´ÊéÆÀ ±»²ÉÄÉΪ¾«ÆÀ¿ÉÒÔ»ñµÃ´óÁ¿½ð±Ò¡¢»ý·ÖºÍ¾­Ñé½±ÀøŶ£¡