The best way to learn design in any field is to study examples, and some of the best examples of software design come from the tools programmers use in their own work. Software Design by Example: A Tool-Based Introduction with Python therefore builds small versions of the things programmers use in order to demystify them and give some insights into how experienced programmers think. From a file backup system and a testing framework to a regular expression matcher, a browser layout engine, and a very small compiler, we explore common design patterns, show how making code easier to test also makes it easier to re-use, and help readers understand how debuggers, profilers, package managers, and version control systems work so that they can use them more effectively.

Finding Duplicate Files.
Suppose we want to find duplicated files, such as extra copies of photos or data sets. People often rename files, so we must compare their contents, but this will be slow if we have a lot of files.
We can estimate how slow “slow” will be with a simple calculation. N objects can be paired in N(N - 1) ways. If we remove duplicate pairings (i.e., if we count A-В and B-A as one pair) then there are N(N - 1)/2 = (N2 - N)/2 distinct pairs. As N gets large, this value is approximately proportional to W2. A computer scientist would say that the time complexity of our algorithm is O(N2), which is pronounced “big-oh of N squared”. In simpler terms, when the number of files doubles, the running time roughly quadruples, which means the time per file increases as the number of files increases.
Slowdown like this is often unavoidable, but in our case there’s a better way. If we generate a shorter identifier for each file that depends only on the bytes it contains, we can group together the files that have the same identifier and only compare the files within a group. This approach is faster because we only do the expensive byte-by-byte comparison on files that might be equal. And as we’ll see, if we are very clever about how we generate identifiers then we can avoid byte-by-byte comparisons entirely.
Contents.
1. Introduction.
1.1. Audience.
1.2. The Big ideas.
1.3. Formatting.
1.4. Usage.
1.5. What People Are Saying.
1.6. Acknowledgments.
1.7. Exercises.
2. Objects and Classes.
2.1. Objects.
2.2. Classes.
2.3. Arguments.
2.4. inheritance.
2.5. Summary.
2.6. Exercises.
3. Finding Duplicate Files.
3.1. Getting Started.
3.2. Hashing Files.
3.3. Better Hashing.
3.4. Summary.
3.5. Exercises.
4. Matching Patterns.
4.1. Simple Patterns.
4.2. Rethinking.
4.3. Summary.
4.4. Exercises.
5. Parsing Text.
5.1. Tokenizing.
5.2. Parsing.
5.3. Summary.
5.4. Exercises.
6. Running Tests.
6.1. Storing and Running Tests.
6.2. Finding Functions.
6.3. Summary.
6.4. Exercises.
7. An Interpreter.
7.1. Expressions.
7.2. Variables.
7.3. Introspection.
7.4. Summary.
7.5. Exercises.
8. Functions and Closures.
8.1. Definition and Storage.
8.2. Calling Functions.
8.3. Closures.
8.4. Summary.
8.5. Exercises.
9. Protocols.
9.1. Mock Objects.
9.2. Protocols.
9.3. Decorators.
9.4. Iterators.
9.5. Summary.
9.6. Exercises.
10. A File Archiver.
10.1. Saving Files.
10.2. Testing.
10.3. Tracking Backups.
10.4. Refactoring.
10.5. Summary.
10.6. Exercises.
11. An HTML Validator.
11.1. HTML and the DOM.
11.2. The Visitor Pattern.
11.3. Checking Style.
11.4. Summary.
11.5. Exercises.
12. A Template Expander.
12.1. Syntax.
12.2. Managing Variables.
12.3. Visiting Nodes.
12.4. Implementing Handlers.
12.5. Control Flow.
12.6. Summary.
12.7. Exercises.
13. A Code Linter.
13.1. Machinery.
13.2. Finding Duplicate Keys.
13.3. Finding Unused Variables.
13.4. Summary.
13.5. Exercises.
14. Page Layout.
14.1. Sizing.
14.2. Positioning.
14.3. Rendering.
14.4. Wrapping.
14.5. Summary.
14.6. Exercises.
15. Performance Profiling.
15.1. Options.
15.2. Row-Wise Storage.
15.3. Column-Wise Storage.
15.4. Performance.
15.5. Summary.
15.6. Exercises.
16. Object Persistence.
16.1. Built-in Types.
16.2. Converting to Classes.
16.3. Aliasing.
16.4. Summary.
16.5. Exercises.
17. Binary Data.
17.1. Integers.
17.2. Bitwise Operations.
17.3. Text.
17.4. And Now, Persistence.
17.5. Summary.
17.6. Exercises.
18. A Database.
18.1. Starting Point.
18.2. Saving Records.
18.3. A File-Backed Database.
18.4. Playing with Blocks.
18.5. Persisting Blocks.
18.6. Cleaning Up.
18.7. Summary.
18.8. Exercises.
19. A Build Manager.
19.1. Concepts.
19.2. Initial Design.
19.3. Topological Sorting.
19.4. A Better Design.
19.5. Summary.
19.6. Exercises.
20. A Package Manager.
20.1. Semantic Versioning.
20.2. Exhaustive Search.
20.3. Generating Possibilities Manually.
20.4. Incremental Search.
20.5. Using a Theorem Prover.
20.6. Summary.
20.7. Exercises.
21. Transferring Files.
21.1. Using TCP/IP.
21.2. Chunking.
21.3. Testing.
21.4. Summary.
21.5. Exercises.
22. Serving Web Pages.
22.1. Protocol.
22.2. Hello, Web.
22.3. Serving Files.
22.4. Testing.
22.5. Summary.
22.6. Exercises.
23. A File Viewer.
23.1. Curses.
23.2. Windowing.
23.3. Moving.
23.4. Refactoring.
23.5. Clipping.
23.6. Viewport.
23.7. Summary.
23.8. Exercises.
24. Undo and Redo.
24.1. Getting Started.
24.2. Insertion and Deletion.
24.3. Going Backward.
24.4. Summary.
24.5. Exercises.
25. A Virtual Machine.
25.1. Architecture.
25.2. Execution.
25.3. Assembly Code.
25.4. Arrays.
25.5. Summary.
25.6. Exercises.
26. A Debugger.
26.1. One Step at a Time.
26.2. Testing.
26.3. Extensibility.
26.4. Breakpoints.
26.5. Summary.
26.6. Exercises.
27. Conclusion.
A Bibliography.
В Bonus Material.
B.1. Using Function Attributes.
B.2. Lazy Evaluation.
B.3. Extension.
B.4. Tracing Inheritance.
B.5. Inspecting Functions.
B.6. User-Defined Classes.
B.7. Floating Point Numbers.
B.8. Big and Little Endian.
B.9 Generating Test Cases.
C Syllabus.
D License.
D.1 Writing.
D.2 Software.
E Code of Conduct.
E.1 Our Standards.
E.2 Our Responsibilities.
E.3 Scope.
E.4 Enforcement.
E.5 Attribution.
F Contributing.
F.1 Editing Content.
F.2 Making Decisions.
F.3 FAQ.
G Glossary.
Index.
Бесплатно скачать электронную книгу в удобном формате, смотреть и читать:
Скачать книгу Software Design by Example, A Tool-Based Introduction with Python, Wilson G., 2024 - fileskachat.com, быстрое и бесплатное скачивание.
Скачать pdf
Ниже можно купить эту книгу, если она есть в продаже, и похожие книги по лучшей цене со скидкой с доставкой по всей России.Купить книги
Скачать - pdf - Яндекс.Диск.
Дата публикации:
Теги: учебник по программированию :: программирование :: Wilson
Смотрите также учебники, книги и учебные материалы:
Следующие учебники и книги:
Предыдущие статьи: