Sunday, March 31, 2024

My learnings from the book "A Philosophy of Software Design"

a philosophy of software design

This is a list of approaches, styles, methodologies, and philosophies in software development and engineering. It also contains programming paradigms, software development methodologies, software development processes, and single practices, principles, and laws. A pass-through method is one that does little except invoke another method witha similar signature.

The nature of complexity

The author is a professor of Computer Science at Stanford, but he has also spent 14 years developing commercial software. John Ousterhout, professor of computer science at Stanford University, joined SE Radio host Jeff Doolittle for a conversation about his book, A Philosophy of Software Design (Yaknyam Press). They discuss the history and ongoing challenges of software system design, especially the nature of complexity and the difficulties in handling it. The conversation also explores various design concepts from the book, including modularity, layering, abstraction, information hiding, maintainability, and readability. By encapsulating complexity via modular design and making code simple and obvious, like eliminating special cases or using consistent coding styles.

Human-AI Guidelines in Practice: Leaky Abstractions as an Enabler in Collaborative Software Teams

If all special cases can be excluded at the beginning, no checks are needed after that. Maybe all the data needed could be combined in a single data structure. The next step is to rearrange the code to be optimized to get as close as possible to this ideal case. A connection with previous chapters is that deep modules are more efficient than shallow, since more work is done for each method call.

Define Errors Out of Existence

This isbecause handler functions aren't invoked directly - it depends on which handlerswere registered at runtime. The first example that jumps to mind personally is Django - the class hierarchyalways seemed to add more complexity than it solved in a lot of cases. Ingeneral I think it's very easy for the complexity of inheritance to outweigh theutility. Decorators are often shallow pass-through methods that add a lot of boilerplatewithout adding much new functionality.

This increases the interface complexity of a module,without increasing the total functionality of the system. It can indicate thatthere is confusion over the division of responsibility between modules orclasses. While all of the above is sensible, personally still prefer single-purpose interfaces, even if that might leave some implementation separately, that could technically be combined. In the case of microservices, an important guiding principle is to avoid separating services while they use/modify the same data source.

Any change to the sender usually also requires a change to the receiver. An example is if you add a new exception, and you then also need to add a new entry in an error message table, but the connection between them is not obvious. IEEE Software presents pioneering ideas, expert analysis, and thoughtful insights for software professionals who need to keep up with rapid technology change. The book does leave a glaring gap on testing and how testability and good architecture go hand in hand. I would recommend a book like Clean Code or Working Effectively with Legacy Code to augment the topics written here.

a philosophy of software design

And in the best modules, the deep functionality is hidden behind a simple interface. If we think about the most complex problems in Computer Science, there are different thoughts on this. Where you must handle exceptions, you should prefer to handle many exceptionswith a single piece of code. There are two main ways to handle exceptions, each with their owncomplexity. The first is to complete the work in spite of the exception, and thesecond is to report the exception upwards (perhaps also running some unwinding /handling logic).

Deep modules

Careers of Philosophy Majors - Daily Nous - Daily Nous

Careers of Philosophy Majors - Daily Nous.

Posted: Tue, 23 Apr 2024 13:40:28 GMT [source]

In chapter 20, the author addresses the topic of performance optimizations. He says that if you try to optimize every statement for maximum speed, it will slow down development and create complexity. Still, if you ignore performance, it is easy to create a system with significant inefficiencies through the code (called the “death by a thousand cuts” scenario). The solution is in the middle, so we design things that are “naturally efficient” but also clean and simple to know which operations are expensive.

Test-driven development

Everything that is discussed in the book is at a fairly general and high-level, but it's still very helpful. As developers, we ultimately owe to ourselves to ensure we reduce complexity. The by-product of reducing complexity for ourselves is that we develop better products for our users. Furthermore, when you work in a codebase, you can easily navigate in and out of methods. In these cases, a comment describing what a method does doesn’t help much.

The author makes a solid case against classitis – the compulsion (particularly in the Java community) to split everything into a new class.

This book discusses how to decompose complex software systems into modules that can be implemented relatively independently. The discussion first begins with a fundamental problem in software design, managing complexity. It then discusses philosophical issues about how to approach the software design process, and it presents a collection of design principles to apply during software design. The benefit of using the interface rather than the implementation directly is not very big, so it doesn’t help in reducing the complexity of the system. It is interesting that this is the complete opposite of the advice in for example Clean Code. There the mantra is to use many small classes and methods, rather than a few bigger ones.

No comments:

Post a Comment

The 12 Best Hair Salons in Los Angeles, Hands Down

Table Of Content Jessica The Clinic (West Hollywood) Best Hair Salons Near Me in Los Angeles Andy LeCompte Salon WELCOME TO HAMMER & NAI...