Created at 8pm, Jan 4
brkSoftware Development
2
Head First Design Patterns
qACQeAVfE_JQENjvil0QFHxDS9MwIFv73sT8nIj8qkM
File Type
PDF
Entry Count
95
Embed. Model
jina_embeddings_v2_base_en
Index Type
hnsw

System Design Interview helper.

If your needs or requirements change (and we know they will), just go ahead and make your own extensions. Sorry, were closed. Thats right, we spent a lot of time getting this code correct and bug free, so we cant let you alter the existing code. It must remain closed to modication. If you dont like it, you can speak to the manager. Our goal is to allow classes to be easily extended to incorporate new behavior without modifying existing code. What do we get if we accomplish this? Designs that are resilient to change and exible enough to take on new functionality to meet changing requirements. 86
id: 7e1cfe1b953d7f017a7a8b2708443a5f - page: 122
Chapter 3 there are no Dumb Questions Q: Open for extension and closed for modication? That sounds very contradictory. How can a design be both? A: Thats a very good question. It certainly sounds contradictory at first. After all, the less modifiable something is, the harder it is to extend, right? As it turns out, though, there are some clever OO techniques for allowing systems to be extended, even if we cant change the underlying code. Think about the Observer Pattern (in Chapter 2)... by adding new Observers, we can extend the Subject at any time, without adding code to the Subject. Youll see quite a few more ways of extending behavior with other OO design techniques. Q: Okay, I understand Observable, but how do I generally design something to be extensible, yet closed for modication? A: Many of the patterns give us
id: 597f2ea2f5e7393ee51c345649ce37ad - page: 122
In this chapter youll see a good example of using the Decorator pattern to follow the OpenClosed principle. Q: How can I make every part of my design follow the Open-Closed Principle? the decorator pattern
id: 56423b4c6b60730d901800a9c2ba4e59 - page: 123
A: Usually, you cant. Making OO design flexible and open to extension without the modification of existing code takes time and effort. In general, we dont have the luxury of tying down every part of our designs (and it would probably be wastefu). Following the Open-Closed Principle usually introduces new levels of abstraction, which adds complexity to our code. You want to concentrate on those areas that are most likely to change in your designs and apply the principles there. Q: How do I know which areas of change are more important? A: That is partly a matter of experience in designing OO systems and also a matter of the knowing the domain you are working in. Looking at other examples will help you learn to identify areas of change in your own designs. While it may seem like a contradiction, there are techniques for allowing code to be extended without direct modif ication.
id: d8435759166dd77af6ecfb3302eb9c72 - page: 123
How to Retrieve?
# Search

curl -X POST "https://search.dria.co/hnsw/search" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"rerank": true, "top_n": 10, "contract_id": "qACQeAVfE_JQENjvil0QFHxDS9MwIFv73sT8nIj8qkM", "query": "What is alexanDRIA library?"}'
        
# Query

curl -X POST "https://search.dria.co/hnsw/query" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"vector": [0.123, 0.5236], "top_n": 10, "contract_id": "qACQeAVfE_JQENjvil0QFHxDS9MwIFv73sT8nIj8qkM", "level": 2}'