background preloader

SOLID (object-oriented design)

SOLID (object-oriented design)
In computer programming, SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Michael Feathers for the "first five principles" named by Robert C. Martin[1][2] in the early 2000s[3] that stands for five basic principles of object-oriented programming and design. The principles when applied together intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time.[3] The principles of SOLID are guidelines that can be applied while working on software to remove code smells by causing the programmer to refactor the software's source code until it is both legible and extensible. It is part of an overall strategy of agile and adaptive programming.[3]

GRASP (object-oriented design) General Responsibility Assignment Software Patterns (or Principles), abbreviated GRASP, consists of guidelines for assigning responsibility to classes and objects in object-oriented design. Larman states that "the critical design tool for software development is a mind well educated in design principles. It is not the UML or any other technology." Thus, GRASP is really a mental toolset, a learning aid to help in the design of object-oriented software. The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have a single UserController, instead of two separate use case controllers). It is defined as the first object beyond the UI layer that receives and coordinates ("controls") a system operation.

Is Design Dead? For many that come briefly into contact with Extreme Programming, it seems that XP calls for the death of software design. Not just is much design activity ridiculed as "Big Up Front Design", but such design techniques as the UML, flexible frameworks, and even patterns are de-emphasized or downright ignored. In fact XP involves a lot of design, but does it in a different way than established software processes. XP has rejuvenated the notion of evolutionary design with practices that allow evolution to become a viable design strategy. It also provides new challenges and skills as designers need to learn how to do a simple design, how to use refactoring to keep a design clean, and how to use patterns in an evolutionary style. Extreme Programming (XP) challenges many of the common assumptions about software development. I find myself at the center of this argument. Well I'm not going to expect that I can leave you dangling on the hook of dramatic tension. Planned and Evolutionary Design

Lehman's laws of software evolution In Software engineering, the Laws of Software Evolution refer to a series of laws that Lehman and Belady formulated starting in 1974 with respect to Software evolution.[1][2] The laws describe a balance between forces driving new developments on one hand, and forces that slow down progress on the other hand. Context[edit] Observing that most software is subject to change in the course of its existence, the authors set out to determine laws that these changes will typically obey, or must obey in order for the software to survive.[citation needed] In his 1980 article,[1] Lehman qualified the application of such laws by distinguishing between three categories of software: The laws are said to apply only to the last category of systems. The Laws[edit] All told eight laws were formulated: References[edit] ^ Jump up to: a b Lehman, Meir M. (1980).

Single responsibility principle In object-oriented programming, the single responsibility principle states that every context (class, function, variable, etc.) should define a single responsibility, and that responsibility should be entirely encapsulated by the context. All its services should be narrowly aligned with that responsibility. Martin defines a responsibility as a reason to change, and concludes that a class or module should have one, and only one, reason to change. As an example, consider a module that compiles and prints a report. Such a module can be changed for two reasons. The reason it is important to keep a class focused on a single concern is that it makes the class more robust. The responsibility is defined as a charge assigned to a unique actor to signify its accountabilities concerning a unique business task.[4] References[edit]

Responsibility-driven design Responsibility-driven design is a design technique in object-oriented programming. It was proposed by Rebecca Wirfs-Brock and Brian Wilkerson, who defined it as follows: Responsibility-driven design is inspired by the client/server model. It focuses on the contract by asking:What actions is this object responsible for?What information does this object share? Responsibility-driven design is in direct contrast with data-driven design, which promotes defining the behavior of a class along the data that it holds. The client/server model they refer to assumes that a software client and a software server exchange information based on a contract that both parties commit to adhere to. Building blocks[edit] In their book Object Design: Roles, Responsibilities and Collaborations,[1] the authors describe the following building blocks that make up responsibility-driven design. Objects[edit] Objects are described as things that have machinelike behaviors that can be plugged together to work in concert.

Feature Injection: three steps to success Feature Injection is a business analysis process framework that allows teams to exploit the value of the traditional business analysis techniques in projects involving frequent iterative deliveries, such as the ones implemented using agile and lean processes. It focuses test-driven-development and behaviour-driven-development on delivering business value and ensures that a team only builds features and projects that deliver value, avoiding the wastes of scope creep and just-in-case code. This article is a high level introduction of Feature Injection and related techniques. We explain the key elements of the framework and support them with a realistic example. To keep the article relatively short, we also provide references for further investigation instead of going into details of individual tools and techniques. Why should you care about Feature Injection? Three steps of Feature Injection Feature Injection was discovered through practice rather than designed as a process. Hunt the value

P of EAA This book started after Dave Rice and I gave some talks on J2EE architecture and mulled over how the concepts we had learned in C++, Forte, CORBA, and Smalltalk had been crucial to us developing good designs in Java. With this book I wanted to set many of these patterns down to help developers whatever their platform. These turned out to be very valuable when we started to use .NET in 2002 and Ruby in 2007. The book is a Duplex Book. Each pattern describes details of how it works and when to use it, together with code examples in Java, C# or both. The main topic areas are: how to layer an enterprise application, how to organize domain logic, how to tie that logic to a relational database, how to design a web based presentation, some important principles in distributed design, and handling of what we call "offline concurrency" - concurrency that spans transactions. I wrote this book in the early noughties, but my colleagues and I find the patterns are still relevant today.

GDS design principles GOV.UK is for anyone who has an interest in how UK government policies affect them. Using this style guidance will help us make all GOV.UK information readable and understandable. It has a welcoming and reassuring tone and aims to be a trusted and familiar resource. We take all of the writing for web points into account when we write for GOV.UK. Then we add the following points based on user testing and analysis on our own website. Active voice Use the active rather than passive voice. Addressing the user Address the user as ‘you’ where possible. Avoid duplication What are you and other departments publishing? We have over 116,000 items of content in departmental and policy areas. Duplicate content confuses the user and damages the credibility of GOV.UK content. If there are 2 pieces of information on a subject, perhaps there are 3 and the user has missed one? If something is written once and links to relevant info easily and well, people are more likely to trust the content. Be concise

7 Patterns to Refactor Fat ActiveRecord Models When teams use Code Climate to improve the quality of their Rails applications, they learn to break the habit of allowing models to get fat. “Fat models” cause maintenance issues in large apps. Only incrementally better than cluttering controllers with domain logic, they usually represent a failure to apply the Single Responsibility Principle (SRP). Early on, SRP is easier to apply. As you add more intrinsic complexity (read: features!) You may be thinking: “But Rails makes it really hard to do OOP right!” I used to believe that too. Don’t Extract Mixins from Fat Models Let’s get this out of the way. “Any application with an app/concerns directory is concerning.” And I agree. Now on to the refactorings! 1. Value Objects are simple objects whose equality is dependent on their value rather than an identity. In Rails, Value Objects are great when you have an attribute or small group of attributes that have logic associated with them. The #worse_than? 2. 3. 4. 5. 6. 7. Wrapping Up P.S.

Abstraction principle (computer programming) When read as recommendation to the programmer, the abstraction principle can be generalized as the "don't repeat yourself" principle, which recommends avoiding the duplication of information in general, and also avoiding the duplication of human effort involved in the software development process. As a recommendation to the programmer, in its formulation by Benjamin C. Pierce in Types and Programming Languages (2002), the abstraction principle reads (emphasis in original):[1] As a requirement of the programming language, in its formulation by David A. Under this very name, the abstraction principle appears into a long list of books. Alfred John Cole, Ronald Morrison (1982) An introduction to programming with S-algol: "[Abstraction] when applied to language design is to define all the semantically meaningful syntactic categories in the language and allow an abstraction over them".[3]Bruce J. Jump up ^ Pierce, Benjamin (2002).

Using Spikes The XP practice of ‘spiking’ has been around for a while but there isn’t a whole lot written about it. Why Spike? The XP site states that the purpose of a spike is “to figure out answers to tough technical or design problems”. Spikes are considered useful when a more accurate time (and cost) estimate is required for an upcoming piece of work. Unsurprisingly the practice of spiking is frequently viewed as a method for improving planning accuracy, but it’s got more to offer: An aid to design Design sessions can be difficult to focus. Expand knowledge Pulling in information from the outside world, searching for similar problems and the solutions used to tackle them exposes the team to new ways of thinking, new techniques and new technologies. Generate ideas Often the effort involved in figuring out potential solutions generates new understanding and insight that can be applied to other areas of how we work and the systems we create. Prevent stalling Safely cover more ground Avoid expensive mistakes

Inversion of Control Containers and the Dependency Injection pattern In the Java community there's been a rush of lightweight containers that help to assemble components from different projects into a cohesive application. Underlying these containers is a common pattern to how they perform the wiring, a concept they refer under the very generic name of "Inversion of Control". In this article I dig into how this pattern works, under the more specific name of "Dependency Injection", and contrast it with the Service Locator alternative. The choice between them is less important than the principle of separating configuration from use. One of the entertaining things about the enterprise Java world is the huge amount of activity in building alternatives to the mainstream J2EE technologies, much of it happening in open source. Underlying these containers are a number of interesting design principles, things that go beyond both these specific containers and indeed the Java platform. Components and Services A Naive Example class MovieLister... Inversion of Control

PragPub February 2013 | Estimation is Evil What you don’t know can hurt you, especially when you convince yourself that you do know it. Many Agile teams—I believe it’s most Agile teams—get some improvement from applying Agile values, principles, and practices. These teams do a better job of predicting when they’ll be done, and a better job of being done at the time they predict. They break requirements down into a backlog, they estimate how long items will take, and they burn through that backlog pretty well. Usually by the predicted end of the project, they’re closer to done than they used to be before they went Agile. Agile teams break down their work into a couple of weeks at a time, and often estimate that work. These teams get better transparency, inside the team and with their management and stakeholders. Teams applying Agile ideas almost always get some improvement. Some teams do much better, and we’ll talk about what they do later on. These teams are better than they were, but are still undistinguished. It seems natural.

Kinect for Windows SDK Beta 2 Quickstarts 8 minutes, 56 seconds 6 minutes, 50 seconds 12 minutes, 16 seconds 15 minutes, 36 seconds 16 minutes, 57 seconds 11 minutes, 48 seconds

Related: