본문 바로가기

분류 전체보기402

State Pattern CHAPTER 15 State Pattern Under pressure. Queen, Under Pressure A very useful tool for thinking through software problems is the state diagram. In a state diagram, you construct a graph, where nodes represent the state of the system and edges are transitions between one node in the system and another. State diagrams are useful because they let you think visually about the state of your system giv.. 2023. 3. 29.
Observer Pattern CHAPTER Observer Pattern You know, Norton, I ve been watching you. Eddie Murphy, Delirious If you did the object calisthenics exercise from chapter 12, you would have noticed how difficult it is to reduce the number of lines used in certain methods. This is especially difficult if the object is too tightly coupled with a number of other objects; i.e., one object relies too much on its knowledge .. 2023. 3. 29.
Iterator Pattern CHAPTER 13 Iterator Pattern e wheels of the bus go round and round, round and round, round and round Data structures and algorithms form an integral part of the software design and development process. Often, different data structures have different uses, and using the right data structure for a specific problem might mean a lot less work and a lot more efficiency. Choosing the correct data stru.. 2023. 3. 29.
Interpreter Pattern CHAPTER Interpreter Pattern Silvia Broome: What do you do when you can t sleep? Tobin Keller: I stay awake. e Interpreter Sometimes it makes sense to not use Python to describe a problem or the solution to such a problem. When we need a language geared toward a specific problem domain, we turn to something called a domain-specific language. Domain-Specific Languages Some languages, like Python, .. 2023. 3. 28.
Command Pattern CHAPTER 11 Command Pattern I ll be back. Terminator The robots are coming. In this chapter, we are going to look at how we can control a robot using Python code. For our purposes, we will be using the turtle module included in the Python standard library. This will allow us to handle commands like move forward, turn left, and turn right without the need to build an actual robot, although you sho.. 2023. 3. 28.
Chain of Responsibility Pattern CHAPTER Chain of Responsibility Pattern It wasn t me. Shaggy, It Wasn t Me Web apps are complex beasts. They need to interpret incoming requests and decide what should be done with them. When you think about creating a framework to help you build web apps more quickly, you stand a very real chance of drowning in the complexity and options involved with such a project. Python is home to many a we.. 2023. 3. 28.
Proxy Pattern CHAPTER 11 Proxy Pattern Do you bite your thumb at us, sir? Abram, Romeo and Juliet As programs grow, you often find that there are functions that you call very often. When these calculations are heavy or slow, your whole program suffers. Consider the following example for calculating the Fibonacci sequence for a number n: def fib(n): if n < 2: return 1 return fib(n - 2) + fib(n - 1) This fairly.. 2023. 3. 28.
Facade Pattern CHAPTER Facade Pattern e Phantom of the Opera is there, inside my mind. Christine In this chapter, we will look at another way to hide the complexity of a system from the users of that system. All the moving parts should look like a single entity to the outside world. All systems are more complex than they seem at first glance. Take, for instance, a point of sale (POS) system. Most people only e.. 2023. 3. 28.
Decorator Pattern CHAPTER 7 Decorator Pattern Time abides long enough for those who make use of it. Leonardo da Vinci As you become more experienced, you will find yourself moving beyond the type of problems that can easily be solved with the most general programming constructs. At such a time, you will realize you need a different tool set. This chapter focuses on one such tool. When you are trying to squeeze ev.. 2023. 3. 28.