12_268607 bindex.qxd 6/10/05 10:26 PM Page 543

Index

- (private) visibility indicator, meaning, 2 # (protected) visibility indicator, and, 223 meaning, 2 class roles, 111 + (public) visibility indicator, meaning, 2 Client role, 112 code example, 114–119 A ConcreteFactory1 role, 112 ABCJournalRecordFactory class, Factory ConcreteFactory2 role, 112 Method pattern, 104 and, 107, 119 Abstract Base Class pattern IFactory interface, 112 abstract base classes, 61 implementation, 113 class roles, 63–64 instances of classes, 110 code example, 64–67 IWidgetA interface, 112 concrete classes, 64 IWidgetB interface, 112 dependencies, 64 Kit, 109 IEnumerator interface, 61 object creation and, 94 implementation, 64 Product1WidgetA role, 112 Interface and Abstract Class Product2WidgetA role, 112 pattern and, 67 and, 139 .NET Framework and, 64 and, 119 Template MethodCOPYRIGHTED pattern and, 67 Toolkit, MATERIAL 109 abstract base classes, behavior, 61 Abstract Superclass, 61 Abstract Class pattern, Interface and AbstractBaseclass, 63–64 Abstract Class pattern, 72 AbstractBuilder class, , 125 abstract classes AbstractCommandHandler class, Chain of extension, 99 Responsibility pattern, 297 , 407 AbstractComposite class, Composite pat- abstract factory class tern, 177 abstract class instances and, 109 AbstractDoorControllerWrapper class, instantiation and, 132 , 266–267

543 12_268607 bindex.qxd 6/10/05 10:26 PM Page 544

544 Index

AbstractElement class, , 419 , 204, 211 AbstractFlyweight class, 238 and, 382 Abstraction class, Bridge pattern, 216 overview, 193 AbstractionImpl interface, Bridge pattern, , 204 217 Read-Only interface pattern, 192 abstractions , 204, 400 Bridge pattern, 213 aggregations hierarchies, combining, 216 class relationships, 8 implementations, creating, 216 composite, 9 logic reuse, 216 algorithms, encapsulation (Strategy pat- AbstractLoadableClass class tern), 395–400 Dynamic Linkage pattern, 248 application-independent objects, 97–98 subclasses, 249 application-specific classes, creation, 96 AbstractPullFilter class, Filter pattern, 167 arbitrary objects, Hashed Adapter Objects AbstractPushFilter class, Filter pattern, 169 pattern, 427 AbstractTemplate class, Template Method ArrayCopier class, 195 pattern, 409 arrowheads, asynchronous calls, 20–21 AbstractVisitor class, Visitor pattern, 419 ASP.NET, Interface and Abstract Class pat- AbstractWrapper class, Decorator pattern, tern and, 70–71 268 assemblies, packages and, 11 accessor methods, attributes, 35 associations Action class, Hashed Adapter Objects pat- association names, 7 tern and, 431 classes, 7 ActionKey class, Hashed Adapter Objects dependencies, 10 pattern and, 431 multiplicity indicators, 8 active buffer, 500 navigation arrows, 7 pattern role names, 7 Asynchronous Processing pattern and, assumptions, requirements and, 29 527 asynchronous calls, arrowheads, 20–21 Future pattern and, 540 asynchronous interactions, collaborative Adaptee classes, , 197 diagram, 19 Adapter classes, Adapter pattern, 197 Asynchronous Processing pattern adapter classes, interfaces, 195 Active Object pattern and, 527 adapter objects, Hashed Adapter Objects code example, 525–527 pattern, 427 Façade pattern and, 527 Adapter pattern Future pattern and, 527, 540 Adaptee classes, 197 implementation, 522–524 Adapter classes, 197 introduction, 438 adapter classes, 195 .NET, 525 Client class, 197 overview, 519 code example, 199–206 Producer-Consumer pattern and, 527 Façade pattern, 204, 231 request management, 522–524 Hashed Adapter Objects pattern and, 435 Scheduler pattern and, 527 implementation, 198–199 thread allocation, 522–524 Interface pattern, 59 pattern and, 527 ITarget interface, 197 12_268607 bindex.qxd 6/10/05 10:26 PM Page 545

Index 545

B Layered Architecture pattern and, 223 Backus-Naur Form (BNF), tokens, 320 .NET Framework, 218 Balking pattern overview, 193 code example, 469–470 SpecializedAbstraction class, 216 Guarded Suspension pattern and, 465, SpecializedAbstractionImpl interface, 470 217 implementation, 469 buffers introduction, 438 active, 500 and, 354 Double Buffering pattern and, 502–503 Single Threaded Execution pattern and, reserve, 500 470 Builder pattern state and, 467–470 AbstractBuilder class, 125 batching notifications, Observer pattern, client classes, 125 378 code example, 128–129 behavioral patterns and, 129 categories, 293 Concrete Builder class, 125 Chain of Responsibility pattern, 295–304 consequences, 127 , 305–315 Director object, 125 Hashed Adapter Objects pattern, 427–435 external data representation, 124 Little Language pattern, 317–342 Factory Method pattern and, 129 Mediator pattern, 343–354 implementation, 126–127 Null Object, 401–405 Interface pattern and, 129 Observer pattern, 373–382 IProduct interface, 124 Snapshot pattern, 355–372 .NET Framework, 128 , 383–394 and, 129 Strategy pattern, 395–400 object creation and, 94 Template Method, 407–413 overview, 121 Visitor, 415–425 Product class, 124 behaviors Strategy pattern and, 129 delegation and, 51 Template Method pattern and, 129 IEnumerator interface, 61 Visitor pattern and, 129 operations, 1 Strategy pattern and, 396 C Bentley, Jon, 317 cache, object limits, 280 BNF (Backus-Naur Form), tokens, 320 Cache class, Cache Management pattern, Both Dirty state, 385 275 Bridge pattern Cache Management pattern Abstract Factory pattern and, 223 ArrayList, 278 Abstraction class, 216 Cache class, 275 abstraction hierarchies, 213 CacheManager class, 275 AbstractionImpl interface, 217 Client classes, 275 code example, 218–223 code example, 282–292 Decorator pattern and, 223 Ephemeral Cache Item pattern and, 292 Factory Method object, 219 Façade pattern and, 292 hierarchy extension, 218 and, 244 implementation, 218 12_268607 bindex.qxd 6/10/05 10:26 PM Page 546

546 Index

Cache Management pattern (continued) class diagrams GetHashCode( ) method, 281 classes and, 6 Hashtable, 279 definition, 2 hit rate, 277 interfaces and, 6 implementation, 275–281 objects, 12 object access, 273 classes and, 161 ABCJournalRecordFactory, 104 Object Replication pattern and, 292 Abstract Base Class pattern, 63–64 ObjectCreator class, 275 abstract factory class, 109 ObjectKey class, 275 AbstractBaseclass, 63–64 Optimistic and, 292 AbstractPushFilter, 169 overview, 193 adapter classes, 195 performance tuning and, 277–281 aggregations, 8 prefetching objects, 277 application-specific, 96 ProductCacheManager class and, 274 ArrayCopier, 195 ProductInfoFetcher object, 274 associations, 7 read consistency, 282 attributes, 1 Singleton pattern and, 147 class diagrams and, 6 Template Method pattern and, 292 Client, 56 Virtual Proxy pattern and, 292 Client, Object Pool pattern, 153 write consistency, 282 compartments, 4 CacheManager class compatibility, Dynamic Linkage pattern Cache Management pattern, 275 and, 248 hit rate and, 280 concrete, Abstract Base Class pattern, 64 ObjectCreator class and, 275 ConcretePushFilter, 169 Caretaker class, Snapshot pattern, 360 constructors, interfaces and, 56 CAS (code access security), Dynamic Link- CSharpCodeProvider, 128 age Pattern and, 249 data-driven, Factory Method pattern, case studies 100–101 business case in deployment, 28–29 data filter classes, 166 essential use cases, 30–32 delegation and, 47 object-oriented analysis, 32–34 DoubleLinkedList, 71–72 object-oriented design, 34–43 ellipsis (...), 3 requirements for deployment, 29–30 Façade pattern, 225 Chain of Responsibility pattern factory method, 132 AbstractCommandHandler class, 297 Game Snapshot, 356 behavior and, 293 hiding, 69 code example, 299–304 inheritance, 47 Command pattern and, 304 LazyCloneDictionary, 86–87 commands, 295 loading, deferred, 259–260 CommandSender class, 297 loading arbitratry, 245–253 Composite pattern and, 185, 304 Mediator pattern, 345 ICommandHandler interface, 297 nested, 11 implementation, 297–298 proxy objects, 81 .NET API, 299 RecordFactoryFactory, 104 object coupling, 299 rectangles, 2 Template Method pattern and, 304 relationships, 7 12_268607 bindex.qxd 6/10/05 10:26 PM Page 547

Index 547

SaleLineItem, 104 Decorator pattern, 270–271 simplified, 4 delegation example, 52–54 Singleton pattern, 142 Double Buffering pattern, 504–518 StartOfSale, 104 Dynamic Linkage pattern, 250–253 State pattern, 386–388 Façade pattern, 228–231 two-compartment classes, 4 Factory Method pattern, 102–107 UserInterface, 356 Filter pattern, 170–174 VBCodeProvider, 128 Flyweight pattern, 239–244 word combination language, 327 Future pattern, 536–540 wrapper classes, 121 Guarded Suspension pattern, 464–465 WrapperGenerator, 123–124 Hashed Adapter Objects pattern, 433–435 XYZJournalRecordFactory, 104 Immutable pattern, 78–79 Client class Interface and Abstract Class pattern, Abstract Factory pattern, 112 71–72 Adapter pattern, 197 Interface pattern example, 58–59 Builder pattern, 125 Iterator pattern, 209–211 Cache Management pattern, 275 Little Language pattern, 331 concrete widget classes and, 113 Object pattern, 457–458 Future pattern, 531 Mediator pattern, 349–354 Hashed Adapter Objects pattern and, 431 Null Object pattern, 404–405 IFactory interface and, 113 Object Pool pattern, 156–161 IIndirection interface, 56 Observer pattern, 379–381 Little Language pattern, 328 Producer-Consumer pattern, 496–498 Object Pool pattern, 153 Prototype pattern, 135–139 problem domain and, 50 Proxy pattern, 83–91 Prototype pattern, 132 Read-Only interface pattern, 190–192 Strategy pattern, 396 Read/Write Lock pattern, 487–492 Virtual Proxy pattern, 257–258 Scheduler pattern, 476–481 Visitor pattern and, 418 Single Threaded Execution pattern, client objects, complex object creation, 444–446 Builder pattern, 121–129 Singleton pattern, 146–147 Clone function Snapshot pattern, 370–371 deep copies, 84, 133 State pattern, 389–394 shallow copies, 84, 133 Static Locking Order pattern, 450–451 code example Strategy pattern, 398–399 Abstract Base Class pattern, 64–67 Template Method pattern, 410–413 Abstract Factory pattern, 114–119 Virtual Proxy pattern, 261–263 Adapter pattern, 199–206 Visitor pattern, 422–425 Asynchronous Processing pattern, coding, deployment and, 27 525–527 collaboration diagram Balking pattern, 469–470 example, 14 Bridge pattern, 218–223 interactions, 14 Builder pattern, 128–129 links, 14 Cache Management pattern, 282–292 collaborations, 14 Chain of Responsibility pattern, 299–304 Colleague classes, Mediator pattern, 349 Command pattern, 310–315 Collection class, Iterator pattern and, 207 Composite pattern, 180–185 12_268607 bindex.qxd 6/10/05 10:26 PM Page 548

548 Index

Collection interface, Iterator pattern and, implementation, 179 207 introduction, 163 collections Little Language pattern and, 342 access, Iterator pattern, 206 .NET Framework, 180 object modification during iteration, 208 Page objects, 175 remote, access, 206 Prototype pattern and, 139 Command pattern recursion, 175 behavior and, 293 Recursive Composition pattern, 175 Chain of Responsibility pattern and, 304 Visitor pattern and, 185, 425 code example, 310–315 Concrete Builder class, Builder pattern, CommandManager class, 306 125 commands, encapsulating, 305 concrete classes ConcreteCommand class, 306 Abstract Base Class pattern, 64 do function, 305 interface implementation, 109 Factory Method pattern and, 315 widget classes, client classes and, 113 ICommand interface, 306 ConcreteCommand class, Command pat- implementation, 307–309 tern, 306 interface dependencies, 308–309 ConcreteLoadableClass class, Dynamic Invoker class, 306 Linkage pattern and, 248 Little Language pattern and, 315 ConcretePullFilter class, Filter pattern, 168 Marker Interface pattern and, 315 ConcretePushFilter class, Filter pattern, .NET, 310 169 Snapshot pattern and, 315, 372 ConcreteService class, Decorator pattern, Template Method pattern and, 315 268 undo function, 305 ConcreteTemplate class, Template Method CommandManager class pattern, 409 Command pattern, 306 concurrency patterns objects, undo/redo, 307–308 Asynchronous Processing, 519–527 CommandSender class, Chain of Respon- Balking pattern, 467–470 sibility pattern, 297 Double Buffering pattern, 499–518 comments, , 52 Future pattern, 529–540 compartments, classes, 2, 4 Guarded Suspension pattern, 459–465 compatibility of classes, Dynamic Linkage Lock Object pattern, 453–458 pattern and, 248 Producer-Consumer pattern, 493–498 composite aggregations, classes, 9 Read/Write Lock pattern, 483–492 Composite pattern Scheduler pattern, 471–481 AbstractComposite class, 177 sequence of operations and, 437 Builder pattern and, 129 shared resources and, 437 Chain of Responsibility pattern and, 185, Single Threaded Execution, 439–446 304 Static Locking Order, 447–451 code example, 180–185 connections Element1 class, 177 dynamic, 165–174 Filter pattern and, 174 IDbConnection interface and, 149–150 Flyweight pattern and, 244 constructors Frame objects, 175 Immutable pattern and, 77 hierarchy and, 177 interfaces, 56, 57–58 IElement interface, 177 .NET Framework, 57–58 12_268607 bindex.qxd 6/10/05 10:26 PM Page 549

Index 549

singleton classes, 143 delegation, 54 wrapper classes, 121 Delegation pattern and, 272 Consumer class, Producer-Consumer pat- Filter pattern and, 174, 272 tern, 495 IAbstractService interface, 268 Context class, State pattern, 387 implementation, 269 Controller pattern, Mediator pattern and, inheritance, 269 354 object functionality, 265 copy, serialization and, 144 overview, 193 creational patterns Prototype pattern and, 139 Abstract Factory pattern, 94, 109–119 Proxy pattern and, 91 Builder pattern, 94, 121–129 Strategy pattern and, 272 Factory Method pattern, 94, 95–108 Template Method pattern and, 272 object creation and, 93 wrapper classes, 121 Object Pool pattern, 94 Wrapper pattern, 265 Prototype pattern, 94, 131–139 deep copies, objects Singleton pattern, 94, 141–147 Clone function, 84 CreationRequester role class, Factory Prototype pattern, 133 Method pattern, 98 deferred class loading, Virtual Proxy pat- CSharpCodeProvider class, Builder pat- tern, 259–260 tern, 128 delegation of object creation, Object Pool pattern, 155 D Delegation pattern data analyses behaviors and, 51 data filter classes, 166 behaviors and, run time, 52 implementation, 166 classes and, 47 data-driven classes, Factory Method pat- code example, 52–54 tern and, 100–101 comments, 52 data filter classes Decorator pattern and, 54, 272 analysis, 166 disadvantages, 52 transformations, 166 implementation, 51 data structure indirect, 52 Hashed Adapter Objects pattern, 433 indirect delegations, 52 object pool, 155 inheritance and, 47–54 data transformations. See transformations Interface pattern and, 59 deadlocked threads .NET and, 52 Single Threaded Execution pattern and, Observer pattern and, 382 443 Proxy pattern and, 54 Static Locking Order pattern, 447–449 roles, 48 deadly embrace, threads (Single Threaded Delegator class, Null Object pattern, 403 Execution pattern), 444–446 dependencies decorator classes, implementation, Abstract Base Class pattern, 64 121–122 dialog boxes, Mediator pattern, 344–345 Decorator pattern dynamically registering, 373 AbstractWrapper class, 268 Façade pattern, 38, 226 Bridge pattern and, 223 interfaces, Command pattern, 308–309 code example, 270–271 logic, Mediator pattern, 349 ConcreteService class, 268 minimizing, 38 12_268607 bindex.qxd 6/10/05 10:26 PM Page 550

550 Index

dependencies (continued) Dynamic Linkage pattern Observer pattern, 373 AbstractLoadableClass class and, 248 requirements and, 29 arbitrary classes, loading, 245 state-related, Mediator pattern classes, ConcreteLoadableClass class, 248 345–346 Environment class, 247 dependent objects, classes, 56 IEnvironment interface, 247 deployment implementation, 248–249 activities leading up to, 26 loading time, 250 coding and, 27 .NET Framework and, 250 essential use cases, 27 overview, 193 high-level system architecture, 27 Protection Proxy pattern and, 253 object-oriented analysis and, 27 security and, 249 object-oriented design, 27 Virtual Proxy pattern and, 253 planning, 26 dynamic registration of dependencies, 373 prototype creation, 27 requirements, 26–27 E testing and, 27 ellipsis (...), classes and, 3 Deserializer class, Snapshot pattern, 358 encapsulation, algorithms (Strategy pat- dialog boxes, Mediator Pattern and, tern), 395–400 343–345 Environment class, Dynamic Linkage pat- Director object, Builder pattern, 125 tern and, 247 DirectShow API, filters, 170 Ephemeral Cache Item pattern, Cache do function, Command pattern, 305 Management pattern and, 292 DocChar class, Flyweight pattern, 234 essential use cases documentation, IEnumerator interface, 61 case study, 30–32 DocumentContainer class, Flyweight pat- deployment and, 27 tern, 234 events DocumentManager object, Factory Method recursive, Mediator pattern, 348 pattern and, 95–97 state and, 22 DocumentVisitor class, Visitor pattern, 417 exception handling, Double Buffering pat- Double Buffering pattern tern and, 503 code example, 504–518 execution order of threads, Schedule pat- DoubleBufferedStream class, 499 tern and, 471–481 exception handling, 503 execution suspension, Guarded Suspen- Guarded Suspension pattern and, 518 sion pattern, 459–465 implementation, 502–503 Expect subroutine, Parser class, 337 introduction, 438 external data representation, Builder pat- multiple buffers, 502 tern and, 124 .NET, 504 Producer-Consumer pattern and, 518 F threads, 502–503 Façade pattern DoubleLinkedList class, 71–72 Adapter pattern and, 204, 231 doubly linked lists, inserting/deleting Asynchronous Processing pattern and, objects, 73 527 dynamic connections, Filter pattern, 165 Cache Management pattern and, 292 dynamic linkage, instantiation and, 132 code example, 228–231 12_268607 bindex.qxd 6/10/05 10:26 PM Page 551

Index 551

dependencies and, 38, 226 Filter pattern implementation, 227–228 AbstractPullFilter class, 167 Interface pattern and, 231 AbstractPushFilter class, 169 .NET Framework, 228 code example, 170–174 object access, 225 Composite pattern and, 174 Object Pool pattern and, 161 ConcretePullFilter class, 168 overview, 193 ConcretePushFilter class, 169 Prototype pattern and, 139 connecting objects dynamically, 165–174 Proxy pattern and, 91 data analyses, 166 Virtual Proxy pattern and, 263 data transformations, 166 wrapper classes, 121 Decorator pattern and, 174, 272 Factory class implementation, 169 Factory Method pattern, 99 introduction, 163 journal-file-related, 103 ISink interface, 169 factory method classes, instantiation and, ISource interface, 167 132 .NET Framework, 170 Factory Method object, Bridge pattern, 219 Pipe pattern and, 174 Factory Method pattern pull filters, 166 ABCJournalRecordFactory class, 104 Sink class, 168, 169 abstract class extension, 99 Source class, 167 Abstract Factory pattern and, 107, 119 state and, 170 Builder pattern and, 129 Flyweight pattern class determination, data-driven, 100–101 AbstractFlyweight class, 238 Command pattern and, 315 Cache Management pattern and, 244 consequences, 101 code example, 239–244 CreationRequester class, 98 Composite pattern and, 244 Factory class, 99 DocChar class, 234 Flyweight pattern and, 244 DocumentContainer class, 234 Hashed Adapter Objects pattern and, 107 Factory Method pattern and, 244 IFactory interface, 98–99 FlyweightFactory class, 238 IJournalRecord interface, 104 IDocumentElement interface, 234 IJournalRecordFactory interface, 104 Immutable pattern and, 244 implementation, 99 implementation, 238 IProduct interface, 98 instances, multiple, 233 Iterator pattern and, 211 .NET Framework and, 239 .NET Framework, 101–102 objects, shared, 239 object creation and, 94 overview, 193 Object Pool pattern and, 161 SharedConcreteFlyweight class, 238 overview, 95 State pattern and, 394 Prototype pattern and, 108, 139 Strategy pattern and, 400 RecordFactoryFactory class, 104 UnsharedConcreteFlyweight class, 238 StartOfSale class, 104 FlyweightFactory class, 238 Strategy pattern and, 108 For Each statement (.NET), Iterator pattern Template Method pattern and, 108 and, 206 XYZJournalRecordFactory class, 104 formal parameters, 3 File Dirty state, 385 Frame objects, Composite pattern, 175 FileStream class, Snapshot pattern, 358 12_268607 bindex.qxd 6/10/05 10:26 PM Page 552

552 Index

function calls, Single Threaded Execution Guarded Suspension pattern pattern, 439 Balking pattern, 465 functions Balking pattern and, 470 Clone, 84 code example, 464–465 interfaces and, 196 Double Buffering pattern and, 518 Iterator pattern, 208 execution suspension, 459–465 multiple parameters, 3 implementation, 461–463 subroutines and, 1 introduction, 438 threads, multiple, 18 .NET, 464 visibility indicators, 2 Producer-Consumer pattern and, 498 Future class, Future pattern, 531 Future pattern H Active Object pattern and, 540 hash tables, data structure, 432–433 Asynchronous Processing pattern and, Hashed Adapter Objects pattern 527, 540 Action class, 431 Client class, 531 ActionKey class, 431 code example, 536–540 adapter objects, 427 encapsulation, 529 Adapter pattern and, 435 exceptions, 534 arbtrary objects, 427 Future class, 531 behaviors and, 293 implementation, 532–534 Client class, 431 introduction, 438 code example, 433–435 .NET, 534–535 data structures, alternate, 433 Observer pattern and, 540 Factory Method pattern and, 107 Promise pattern, 529 GetHashCode( ) function, 432 Proxy pattern and, 533, 540 hash table data structure, 432–433 rendezvous, 534 IAction interface, 431 Requester class, 531 implementation, 432–433 Result class, 531 Lookup Table pattern and, 435 synchronous computation launch, 533 Polymorphism pattern and, 435 Virtual Proxy pattern and, 540 Single Threaded Execution pattern and, 435 G Strategy pattern and, 435 Game Snapshot classes, 356 Hashtable, Cache Management pattern, GameModel class, Snapshot pattern, 357 279 generics, Iterator pattern, 207 hierarchy GetClassname method, singleton classes, Composite pattern and, 177 143 extending, Bridge pattern, 218 GetHashCode( ) function high-level system architecture, deploy- Cache Management pattern, 281 ment, 27 Hashed Adapter Objects pattern, 432 hit rate, cache manager and, 277 GetInstance method concurrent calls, 144–145 I singleton classes, 143 IAbstractService interface, Decorator pat- grammar, language tern, 268 definition, 317 IAction interface, Hashed Adapter Objects tokens, 320 pattern and, 431 12_268607 bindex.qxd 6/10/05 10:26 PM Page 553

Index 553

IBuilder interface, Builder pattern, 125 shared references and, 75 ICloneable interface, 84, 131 Single Threaded Execution pattern ICommand interface, Command pattern, and, 79 306 state information, 75, 76 ICommandHandler interface, Chain of String class and, 78 Responsibility pattern, 297 threads, 76 ICopyFilter interface, 195 value objects and, 75, 76 IDbConnection interface, data source con- impelementation, Read/Write Lock pat- nections, 149–150 tern, 486 IDescription interface implementation browser object, 55 Abstract Base Class pattern, 64 code example, 58–59 Abstract Factory pattern, 113 IDictionary object, cloning, 85 Adapter pattern, 198–199 IDocumentElement interface, Flyweight Asynchronous Processing pattern, pattern, 234 522–524 IElement interface, Composite pattern, 177 Balking pattern, 469 IEnumerable interface, Iterator pattern Bridge pattern, 218 and, 207 Builder pattern, 126–127 IEnumerator interface Cache Management pattern, 275–281 behavior implementation, 61 Chain of Responsibility pattern, 297–298 documentation, 61 Command pattern, 307–309 Iterator pattern and, 207 Composite pattern, 179 IEnvironment interface, Dynamic Linkage decorator classes, 121–122 pattern and, 247 Decorator pattern, 269 IFactory interface delegation, 51 Abstract Factory pattern, 112 Double Buffering pattern, 502–503 client classes and, 113 Dynamic Linkage pattern, 248–249 Factory Method pattern, 98–99 Façade pattern, 227–228 IFormatter interface, Snapshot pattern, 361 Filter pattern, 169 IInderection interface, Client class, 56 Flyweight pattern, 238 IJournalRecord interface, Factory Method Future pattern, 532–534 pattern, 104 Guarded Suspension pattern, 461–463 IJournalRecordFactory interface, Factory Hashed Adapter Object pattern, 432–433 Method pattern, 104 Immutable pattern, 77 IMemento interface, Snapshot pattern, 360 Iterator pattern, 207–209 IMilestoneMemento interface, Snapshot Little Language pattern, 329–330 pattern, 357 Lock Object pattern, 455–456 Immutable pattern Mediator pattern, 347–348 code example, 78–79 Null Object pattern, 403 constructors and, 77 Object Pool pattern, 154–156 Flyweight pattern and, 244 Observer pattern, 376–378 implementation, 77 parser, recursive descent, 334 instance variables, 77 Producer-Consumer pattern, 496 .NET and, 78 Prototype pattern, 133–134 Read-Only interface pattern and, 79 Proxy pattern, 83 robustness and, 75 Read-Only interface pattern, 190–192 12_268607 bindex.qxd 6/10/05 10:26 PM Page 554

554 Index

implementation (continued) collaborative diagrams, 14 Scheduler pattern, 476 multilevel sequence numbers, 15 Single Threaded Execution pattern, preconditions, 20 442–443 repeated, 16 Singleton pattern, 143–145 sequence numbers, 14 Snapshot pattern, 363–370 sequence numbers, multilevel, 15 State pattern, 388–389 Interface and Abstract Class pattern Static Locking Order pattern, 449 Abstract Base Class pattern and, 67 Strategy pattern, 397 Abstract Class pattern and, 72 Template Method pattern, 410 ASP.NET and, 70–71 Virtual Proxy pattern and, 259–260 code example, 71–72 Visitor pattern, 421 Interface pattern and, 72 indirect delegations, intermediate classes overview, 69 and, 52 Interface pattern inheritance Adapter pattern, 59 classes and, 47 Builder pattern and, 129 Decorator pattern, 269 code example, 58–59 delegation, 47–54 constructors, 57–58 inappropriate use, 51 delegates, 57 roles, 48 Delegation pattern and, 59 INonterminal interface, Little Language dependent objects, 56 pattern, 328 Façade pattern and, 231 instance variables, Immutable pattern IDescription, 55 and, 77 IDescription interface, 55 instances IInderection interface, 56 Abstract Factory pattern and, 110 implementation, 56–58 Immutable pattern and, 76 instances and, 55 interfaces and, 55 Interface and Abstract Class pattern, 72 loaded classes, 247 .NET delegates, 57 maximum number, Object Pool pattern, Read-Only interface pattern, 192 155 Reference Interface, 55 modification, 189 Strategy pattern, 59 multiple, singleton classes, 143 interfaces Object Pool pattern, 151 class diagrams and, 6 object reuse, 151 compartments, 5 singleton classes, 145 constructors, 56, 57–58 Strategy pattern, 396 dependencies, Command pattern, instantiation 308–309 abstract factory classes, 132 function calls, 196 dynamic linkage and, 132 IAbstractService, 268 factory method classes and, 132 IAction, 431 singleton classes, 143 IBuilder interface, 125 Singleton pattern and, 141–147 ICloneable interface, 84 Virtual Proxy pattern, 255–263 ICommandHandler, 297 interactions ICopyFilter, 195 asynchronous, 19 IDbConnection, 149–150 collaborations, 14 IDocumentElement, 234 12_268607 bindex.qxd 6/10/05 10:26 PM Page 555

Index 555

IEnvironment, 247 Iterator pattern IFactory interface, 98–99 Adapter pattern, 204, 211 IFormatter, 361 code example, 209–211 IJournalRecord, 104 collection access, 206 IJournalRecordFactory, 104 Collection class, 207 IMilestoneMemento, 357 Factory Method pattern, 211 implementation, concrete classes and, functions, 208 109 generics, 207 INonterminal, 328 ICollection interface, 207 IObservable, 375 IEnumerable interface, 207 IObserver, 375 IEnumerator interface, 207 IOperation, 403 implementation, 207–209 IReadOnly interface, 190 Iterator class, 207 IScheduleOrdering, 474 multiple orderings, 208 ISerializable, 365 .NET Framework, 209 IService, 259 null iterator, 208 ISink, 169 Null Object pattern, 211 IStrategy, 396 overview, 193 ITarget interface, 197 sequential access, 205 Mediator pattern, 345 Visitor pattern and, 425 stereotype, 5 IWidgetA interface, Abstract Factory pat- subroutine calls, 196 tern, 112 internal ToC table, Visitor pattern, 415 IWidgetB interface, Abstract Factory pat- Invoker class, Command pattern, 306 tern, 112 IObservable interface, 376–377 IObserver interface, Observer pattern, 375 L IOperation interface, Null Object pattern, languages, 317. See also Little Language 403 pattern IProduct interface, Builder pattern, 124 combinations of words, 318 IPrototype interface, Prototype pattern lexical rules for word combination lan- and, 132 guage, 326 Iprotype interface, Prototype pattern and, parse tree, 323 133 precedence rule, 319 IReadOnly interface, Read-Only interface regular expression, 325 pattern, 190 semantics, 317 is-a-part-of relationships, 36 syntax, 317 is-a relationships, 35 tokens, grammar, 320 IScheduleOrdering interface, 474 white space, 324 ISerializable interface, 365 Layered Architecture pattern IService interface, Virtual Proxy pattern, Bridge pattern and, 223 259 Object Pool pattern and, 161 ISink interface, Filter pattern, 169 lazy instantiation, Virtual Proxy pattern IStrategy interface, Strategy pattern, 396 and, 255 ITarget interface, Adapter pattern, 197 LazyCloneDictionary class, 86–87 Iterator class, Iterator pattern and, 207 lexical rules for word combination lan- guage, 326 12_268607 bindex.qxd 6/10/05 10:26 PM Page 556

556 Index

LexicalAnalyzer, Little Language pattern, code example, 349–354 328 Colleague classes, 349 links, collaborative diagrams, 14 Controller pattern and, 354 Little Language pattern dialog boxes, dependencies, 344–345 behavior and, 293 dialog boxes and, 343–344 Client class, 328 implementation, 347–348 code example, 331 interfaces and, 345 combinations of words, 318 Low Coupling/High Cohesion pattern Command pattern and, 315 and, 354 Composite pattern and, 342 Mediator object, 346–347 implementation, 329–330 Observer pattern and, 354, 382 INonterminal interface, 328 recursive events, 348 and, 317 state and, 343 lexical rules for word combination lan- State pattern and, 394 guage, 326 White Box Testing pattern and, 354 LexicalAnalyzer, 328 MemberwiseClone function, 84 little languages (Jon Bentley), 317 Memento class, Snapshot pattern, 360 .NET, 331 Memento objects Parser class, 328 serialization comparison, 362 reserved words, 318 Snapshot pattern, 359–360 TerminalToken class, 329 state, 362 tokens, grammar, 320 , Snapshot pattern, 355 Visitor pattern and, 342, 425 MilestoneMemento class, Snapshot pat- word combination language classes, 327 tern, 357 WordCombination class, 339 MilestoneMementoManager class, Snap- Lock Object pattern shot pattern, 357 code example, 457–458 Multicaster class, Observer pattern and, implementation, 455–456 376, 377 introduction, 438 multilevel sequence numbers, 15 Object Pool pattern and, 161 interactions, 15 Single Threaded Execution pattern and, multiobjects, 15 458 multiplicity indicators, associations, 8 Static Locking Order pattern and, 451, Mutable class, Read-Only interface pat- 458 tern, 190 threads, object locks and, 454 MutatorClient class, Read-Only interface lock objects, threads, 454 pattern, 190 logic, Visitor pattern, 415–425 Lookup Table pattern, Hashed Adapter N Objects pattern and, 435 names, association names, 7 Low Coupling/High Cohesion pattern, namespaces, packages and, 11 Mediator pattern and, 354 navigation arrows, associations, 7 nested classes, 11 M .NET Marker Interface pattern, Command pat- Abstract Base Class pattern and, 64 tern and, 315 Asynchronous Processing pattern, 525 Mediator pattern Bridge pattern, 218 Balking pattern and, 354 Builder pattern, 128 classes, 345 Chain of Responsibility pattern, 299 12_268607 bindex.qxd 6/10/05 10:26 PM Page 557

Index 557

Command pattern, 310 object-oriented design Composite pattern, 180 case study, 34–43 constructors, 57–58 deployment, 27 delegate, stereotype, 5 object pool delegation and, 52 hiding, 154–155 Double Buffering pattern and, 504 size limit, 155–156 Dynamic Linkage pattern, 250 stateful objects, 156 Façade pattern, 228 structure, 155 Factory Method pattern and, 101–102 Object Pool pattern Filter pattern, 170 Cache Management pattern and, 161 Flyweight pattern, 239 Client class, 153 Future pattern, 534–535 code example, 156–161 Guarded Suspension pattern, 464 Façade pattern and, 161 Immutable pattern and, 78 Factory Method pattern and, 161 Iterator pattern, 209 implementation, 154–156 Little Language pattern, 331 instances, 151 Observer pattern, 379 instances, maximum number, 155 Producer-Consumer pattern, 496 Layered Architecture pattern and, 161 Prototype pattern, 135 Lock Object pattern and, 161 Read/Write Lock pattern, 487 object creation, 94, 156 Singleton pattern, 145 object reuse, 149–161 Strategy pattern, 397 Reusable object, 153 .NET delegates, Interface pattern, 57 ReusablePool object, 154 non-terminal tokens, language, 320 Singleton pattern and, 147, 161 Not Dirty state, 384 Thread Pool pattern and, 161 notifications, batching, Observer pattern, Virtual Proxy pattern and, 263 378 Object Replication pattern, Cache Manage- null iterator, Iterator pattern, 208 ment pattern and, 292 Null Object pattern Object Request Broker pattern, Proxy pat- Builder pattern and, 129 tern and, 91 code example, 404–405 object reuse Delegation class, 403 instances, 151 implementation, 403 Object Pool pattern, 149–161 IOperation interface, 403 ObjectCreator class, Cache Management Iterator pattern and, 211 pattern, 275 NullOperation class, 403 ObjectKey class, Cache Management pat- object absence, 401 tern, 275 RealOperation class, 403 objects Singleton pattern and, 405 cache limits, 280 Strategy pattern and, 400, 405 class diagrams, 12 NullOperation class, Null Object pattern, commands, Chain of Responsibility pat- 403 tern, 295 commands, Command pattern, 305 O creation, delegating, 155 object diagrams, example, 13 creation, Object Pool pattern and, 156 object-oriented analysis creational patterns and, 93 case study, 32–34 custom, Prototype pattern and, 131 deployment and, 27 deep copies, 84 12_268607 bindex.qxd 6/10/05 10:26 PM Page 558

558 Index

objects (continued) operations deep copies, Prototype pattern and, 133 behaviors, 1 deleting, doubly linked lists and, 73 meaning, 1 dependent, 56 sequence, concurrency patterns and, 437 flyweight, shared, 239 Optimistic Concurrency pattern, Cache inserting, double linked lists and, 73 Management pattern and, 292 modifying, iteration and, 208 Originator class, Snapshot pattern, 360 modifying, Read-Only interface pattern, 187–192 P multiobjects, 15 packages prototypes, 131, 132–139 (See also Proto- assemblies, 11 type pattern) namespaces, 11 proxy objects (See proxy objects) visibility indicators, 11 read-only status, 189 Page objects, Composite pattern, 175 read/write access, 483–492 Param Dirty state, 385 Reusable, Object Pool pattern, 153 parameters serialization, 144 formal, 3 ServiceProxy, 82–83 multiple, functions, 3 shallow copies, 84 multiple, subroutines, 3 shallow copies, Prototype pattern and, parse tree 133 introduction, 323 shared references, Immutable pattern token sequences, 323 and, 75 parser, recursive descent, 334 shared service objects, Virtual Proxy pat- Parser class tern, 259 Expect subroutine, 337 temporary, 15 Little Language pattern, 328 ObjectStructure class, Visitor pattern and, partitioning patterns 418 Composite pattern, 163, 175–185 Observer pattern Filter pattern, 163, 165–174 Adapter pattern and, 382 Read-Only interface pattern, 187–192 batching notifications, 378 Read-Only pattern, 163 behavior and, 293 performance tuning, Cache Management code example, 379–381 pattern and, 277–281 Delegation pattern and, 382 persistence, serialization and, 144 dependencies, 373 Pipe pattern Future pattern and, 540 Filter pattern and, 174 implementation, 376–378 Producer-Consumer pattern and, 498 IObservable interface and, 375 planning, deployment and, 26 IObserver interface and, 375 polling, Future pattern, 532–533 Mediator pattern and, 354, 382 Polymorphism pattern Multicaster class and, 376, 377 Hashed Adapter Objects pattern and, 435 .NET, 379 State pattern and, 394 Observable class, 375, 376–377 precedence rule, language, 319 Observer class, 375 preconditions, interactions, 20 Publish-Subscribe pattern and, 382 prefetching objects, Cache Management veto changes, 378 pattern and, 277 12_268607 bindex.qxd 6/10/05 10:26 PM Page 559

Index 559

private (-) visibility indicator, meaning, 2 object creation and, 94 problem domain, client classes, 50 overview, 131 Processor class, Scheduler pattern, 473 shallow copying, 133 Producer class, Producer-Consumer pat- symbol objects, 131 tern, 495 SymbolBuilder objects, 132 Producer-Consumer pattern PrototypeBuilder objects, Prototype pat- Asynchronous Processing pattern and, tern implementation, 133–134 527 proxy objects code example, 496–498 classes, 81 Consumer class, 495 description, 81 Double Buffering pattern and, 518 function calls, 81–82 Guarded Suspension pattern and, 498 Proxy pattern and, 81 implementation, 496 uses, 81–82 introduction, 438 Proxy pattern .NET, 496 Adapter pattern, 204 Pipe pattern and, 498 code example, 83–91 Producer class, 495 Decorator pattern and, 91 Queue class, 495 delegation, 54 Scheduler pattern and, 498 Façade pattern and, 91 Product class, Builder pattern, 124 Future pattern and, 532–533, 540 ProductCacheManager class, Cache Man- implementation, 83 agement pattern, 274 Object Request Broker pattern and, 91 ProductInfoFetcher object, Cache Manage- organization, 82–83 ment pattern, 274 Protection Proxy pattern and, 91 protected (#) visibility indicator, proxy objects and, 81 meaning, 2 Virtual Proxy pattern and, 91, 263 Protection Proxy pattern wrapper classes, 121 Dynamic Linkage pattern and, 253 public (+) visibility indicator, meaning, 2 Proxy pattern and, 91 Publish-Subscribe pattern, Observer pat- Prototype Builder class, roles, 133 tern and, 382 prototype, deployment and, 27 pull filters Prototype pattern AbstractPullFilter class, 167 Abstract Factory pattern and, 139 introduction, 166 code, 135–139 pull method, Queue class, 459 Composite pattern and, 139 push method, Queue class, 459 consequences, 134–135 custom objects, 131 Q Decorator pattern and, 139 Queue class deep copying, 133 Producer-Consumer pattern, 495 Façade pattern and, 139 pull method, 459 Factory Method pattern and, 108, 139 push method, 459 ICloneable interface, 131 implementation, 133–134 R IProrotype interface and, 132 read consistency, cache management and, Iprotype, 133 282 .NET Framework and, 135 read-only access, IEnumerator interface, 61 12_268607 bindex.qxd 6/10/05 10:26 PM Page 560

560 Index

Read-Only Interface pattern Request class, Scheduler pattern, 473 Adapter pattern and, 192 request management, Asynchronous Pro- code example, 190–192 cessing pattern, 522–524 Immutable pattern and, 79 Requester class, Future pattern, 531 implementation, 190–192 requirements Interface pattern and, 192 assumptions, 29 IReadOnly interface, 190 case study, 29–30 Mutable class, 190 dependencies, 29 MutatorClient class, 190 deployment and, 26–27 object modification, 187–192 risks, 29 ReadOnly Client class, 190 reserve buffer, 500 Snapshot pattern and, 372 reserved words, Little Language pattern, Read-Only pattern, 163 318 Read/Write Lock pattern Result class, Future pattern, 531 code example, 487–492 Reusable object, Object Pool pattern, 153 concurrent read access, 483–492 ReusablePool object, Object Pool pattern, impelementation, 486 154 introduction, 438 reusing objects, Object Pool pattern, .NET, 487 149–161 Scheduler pattern and, 481, 492 risks, requirements and, 29 Single Threaded Execution pattern and, role names, associations, 7 492 roles ReadOnlyClient class, Read-Only interface delegation, 48 pattern, 190 inheritance, 48 RealOperation class, Null Object pattern, 403 S RecordFactoryFactory class, Factory Scheduler class, Scheduler pattern, 473 Method pattern, 104 Scheduler pattern rectangles, classes, 2 Asynchronous Processing pattern and, recursion 527 Composite pattern, 175 code example, 476–481 Mediator pattern, 348 implementation, 476 tail recursion, 335 IScheduleOrdering interface, 474 Recursive Composition pattern, 175 Processor class, 473 recursive descent parsers, 334 Producer-Consumer pattern and, 498 redo commands, 307–308 Read/Write Lock pattern and, 481, 492 Reference Interface, indirection, 55 Request class, 473 references, shared (Immutable pattern), 75 Scheduler class, 473 regular expression languages, 325 thread execution, 471–481 relationships security is-a, 35 Dynamic Linkage pattern, 249 is-a-part-of, 36 object modification, 187–192 remote procedure calls, serialization and, semantics, language, 317 144 sequence numbers, interactions renderer filter, DirectShow API filters, 170 introduction, 14 rendezvou, Future pattern, 534 multilevel, 15 ReorgVisitor class, Visitor pattern, 417 12_268607 bindex.qxd 6/10/05 10:26 PM Page 561

Index 561

sequence of operations, concurrency pat- object copies, 143 terns and, 437 subclassing, 145 sequential access variables, 143 IEnumerator interface, 61 Singleton pattern Iterator pattern, 205 Abstract Factory pattern and, 119 serialization Cache Management pattern and, 147 Memento object comparison, 362 classes, 142 objects, 144 code example, 146–147 persistence and, 144 implementation, 143–145 remote procedure calls and, 144 instantiation and, 141–147 SOAP and, 144 .NET API, 145 XML (Extensible Markup Language) and, Null Object pattern and, 405 144 object creation and, 94 Serialize method, Snapshot pattern and, Object Pool pattern and, 147, 161 363–365 State pattern and, 394 Serializer class, Snapshot pattern, 358 Sink class, Filter pattern, 168, 169 Service class, Virtual Proxy pattern, 257 Snapshot pattern ServiceProxy class, Virtual Proxy pattern, Caretaker class, 360 258–259 code example, 370–371 ServiceProxy objects, 82–83 Command pattern and, 315, 372 shallow copies, objects Deserializer class, 358 Clone function, 84 FileStream class, 358 Prototype pattern, 133 Game Snapshot classes, 356 shared references, Immutable pattern GameModel class, 357 and, 75 IFormatter interface, 361 shared resources, concurrency patterns IMemento interface, 360 and, 437 IMilestoneMemento interface, 357 SharedConcreteFlyweight class, 238 implementation, 363–370 Single Threaded Execution pattern Memento class, 360 Balking pattern and, 470 Memento objects and, 359–360 code example, 444–446 Memento pattern and, 355 deadlocked threads, 443 MilestoneMemento class, 357 function calls, concurrent, 439 MilestoneMementoManager class, 357 Hashed Adapter Objects pattern and, 435 Originator class, 360 Immutable pattern and, 79 Read-Only Interface pattern and, 372 implementation, 442–443 Serializer class, 358 Lock Object pattern and, 458 Stream class, 361 Read/Write Lock pattern and, 492 Target object, 361 shared resources and, 437 TextFileReader class, 369 TrafficSensor class, 440 UserInterface class, 356 TrafficSensorController class, 440 SOAP (Simple Object Access Protocol), TrafficTransmitter class, 440 serialization and, 144 singleton classes software, deployment, activities leading access, 143 up to, 26 constructors, 143 software lifecycle, 25–26 instances, 145 Source class, Filter pattern, 167 instantiation, 143 source filter, DirectShow API filters, 170 12_268607 bindex.qxd 6/10/05 10:26 PM Page 562

562 Index

SpecializedAbstraction class, Bridge pat- stateful objects, 383 tern, 216 Static Locking Order pattern SpecializedAbstractionImpl interface, code example, 450–451 Bridge pattern, 217 deadlocks, 447–449 StartOfSale class, Factory Method pattern, implementation, 449 104 introduction, 438 state Lock Object pattern and, 451, 458 Balking pattern, 467–470 static relationships, inheritance and, 50 Both Dirty state, 385 stereotypes dependencies, Mediator pattern, 345–346 definition, 3 encapsulation, State pattern, 383–394 interfaces, 5 events, 22 .NET delegate, 5 File Dirty state, 385 Strategy pattern filter objects, 170 Adapter pattern, 204, 400 Immutable pattern and, 75 algorithm encapsulation, 395 Mediator pattern, 343–354 Builder pattern and, 129 Memento objects, 362 Client class, 396 Not Dirty state, 384 code example, 398–399 notification batching, Observer pattern, Decorator pattern and, 272 378 Factory Method pattern and, 108 object pool, 156 Flyweight pattern and, 400 Param Dirty state, 385 Hashed Adapter Objects pattern and, 435 serialization and, 362 implementation, 397 Snapshot pattern, 355–372 Interface pattern and, 59 transitions, 23 IStrategy interface, 396 State class, State pattern, 387 .NET API usage, 397 state machines Null Object pattern and, 400, 405 implementation, 42 Template Method pattern and, 400, 413 statechart diagrams, 22 Stream class, Snapshot pattern, 361 State pattern String class, Immutable pattern and, 78 Both Dirty state, 385 structural patterns classes, 386–388 Adapter pattern, 195–206 code example, 389–394 Bridge pattern, 213–223 Context class, 387 Cache Management, 273–292 File Dirty state, 385 Decorator pattern, 265–272 Flyweight pattern and, 394 Dynamic Linkage pattern, 245–253 implementation, 388–389 Façade pattern, 225–228 Mediator pattern and, 394 Flyweight pattern, 233–244 Not Dirty state, 384 Iterator pattern, 205–211 Param Dirty state, 385 Virtual Proxy pattern, 255–263 Polymorphism pattern and, 394 subclassing, singleton classes, 145 Singleton pattern and, 394 subroutines State class, 387 functions and, 1 state encapsulation, 383–394 interfaces and, 196 statechart diagrams multiple parameters, 3 state machines and, 22 threads, multiple, 18 transition lines, 23 visibility indicators, 2 12_268607 bindex.qxd 6/10/05 10:26 PM Page 563

Index 563

suspended execution, Guarded Suspen- deadly embrace, Single Threaded Execu- sion pattern, 459–465 tion pattern, 444–446 Symbol objects, SymbolBuilder objects, 132 Double Buffering pattern and, 502–503 symbol objects, Prototype pattern and, 131 execution order, Schedule pattern and, SymbolBuilder objects, 132 471–481 synchronous design, 519 functions, 18 syntax, language Immutable pattern and, 76 combinations of words, 318 lock objects and, 454 definition, 317 multiple, 18 grammar, 317 subroutines, 18 system architecture, deployment and, 27 TOCVisitor class, Visitor pattern, 417 tokens, grammar, 320, 323 T transform filter, DirectShow API filters, tail recursion, 335 170 Target object, Snapshot pattern, 361 transformations Template Method pattern data filter classes, 166 Abstract Base Class pattern and, 67 implementation, 166 abstract classes, 407 transition lines, state charts, 23 AbstractTemplate class and, 409 transitions, state, State pattern, 388 behavior and, 294 two-compartment classes, example, 4 Builder pattern and, 129 Cache Management pattern and, 292 U Chain of Responsibility pattern and, 304 UML (Unified Modeling Language), 1 code example, 410–413 undo function, 305, 307–308 Command pattern and, 315 UnsharedConcreteFlyweight class, 238 ConcreteTemplate class and, 409 user interface, windowing systems, 109 Decorator pattern and, 272 UserInterface class, Snapshot pattern, 356 Factory Method pattern and, 108 implementation, 410 V Strategy pattern and, 400, 413 value objects temporary objects, collaboration, 15 Immutable pattern and, 75, 76 terminal tokens, language, 320 purpose, 75 TerminalToken class, Little Language pat- variables tern, 329 singleton classes, 143 testing, deployment and, 27 visibility indicators, 2 TextFileReader class, Snapshot pattern, 369 VBCodeProvider class, Builder pattern, Thread Pool pattern 128 Asynchronous Processing pattern and, VB.NET. See also .NET 527 assumptions about, 1 Object Pool pattern and, 161 interfaces and, 57 threads veto changes, Observer pattern, 378 Asynchronous Processing pattern, Virtual Proxy pattern 522–524 Cache Management pattern and, 292 deadlocked, Single Threaded Execution Client class, 257–258 pattern, 443 code example, 261–263 deadlocked, Static Locking Order pat- deferred class loading, 259–260 tern, 447–449 12_268607 bindex.qxd 6/10/05 10:26 PM Page 564

564 Index

Virtual Proxy pattern (continued) W Dynamic Linkage pattern and, 253 White Box Testing pattern, Mediator pat- Façade pattern, 263 tern and, 354 Future pattern and, 540 white space, 324 implementation, 259–260 word combination language classes, 327 instantiation and, 255–263 word combination language lexical rules, IService interface, 259 326 Object Pool pattern, 263 WordCombination class, Little Language overview, 193 pattern, 339 Proxy pattern, 91, 263 WordProcessor class, Visitor pattern, 416 Service class, 257 words. See languages; Little Language ServiceProxy class, 258–259 pattern shared service objects, 259 wrapper classes visibility indicators constructors, 121 meanings, 2 Decorator pattern, 121 packages, 11 definition, 121 Visitor pattern Façade pattern and, 121 AbstractElement class and, 419 Proxy pattern and, 121 AbstractVisitor class and, 419 source creation, 123 Builder pattern and, 129 wrapper objects, inheritance and, 269 Client class and, 418 Wrapper pattern. See Decorator pattern code example, 422–425 WrapperGenerator class, 123–124 Composite pattern and, 185, 425 write consistency, cache management and, DocumentVisitor class, 417 282 implementation, 421 Iterator pattern and, 425 X–Y–Z Little Language pattern and, 342, 425 XML (Extensible Markup Language ), seri- logic and, 415 alization and, 144 ObjectStructure class and, 418 XYZJournalRecordFactory class, Factory ReorgVisitor class, 417 Method pattern, 104 TOCVisitor class, 417 WordProcessor class, 416 12_268607 bindex.qxd 6/10/05 10:26 PM Page 565 12_268607 bindex.qxd 6/10/05 10:26 PM Page 566 12_268607 bindex.qxd 6/10/05 10:26 PM Page 567 12_268607 bindex.qxd 6/10/05 10:26 PM Page 568 12_268607 bindex.qxd 6/10/05 10:26 PM Page 569 12_268607 bindex.qxd 6/10/05 10:26 PM Page 570 12_268607 bindex.qxd 6/10/05 10:26 PM Page 571 12_268607 bindex.qxd 6/10/05 10:26 PM Page 572