Scooooooooore!

Navigation

A Swiss Knife is a multi tool pocket knife which was originated from Switzerland. A Swiss Knife has various different models like the Wenger Giant or the Victorinox Swisschamp XAVT and each model has its own set of different tool combinations. For designing a Swiss Knife, certain principles are applied which are known as the SOLID object-oriented design principles. A few of these can be applied on the design of a Swiss Knife while the others fail to do so - you will see the difference between knives that are specifically purposed for the occasion (see Cut it Fine), as opposed to a Swiss knife. Check them out as follows.

1. The Single Responsibility Principle

The Single Responsibility Principle also known as SRP is the first principle which basically states that, " Every object should have a single responsibility i.e. a single reason to change." This means that an object should be able to perform only one specific task and it should only be created for accomplishing one goal. This principle of design is not applicable to a Swiss Knife in its full context because although a Swiss Knife is only created for defense, it performs various tasks. It not only works as a knife, but also a screwdriver, can opener, scissor, flashlight, nail filer but also as the object that is used as a projectile.

2. Open Closed Principle

The OCP principle preaches that, "Objects should be open for extension, but closed for modification." This means that when a function has been finalized, it should not be changed later. You can add new functions to it without changing its existing internal function. This protects the existing function from breaking at the time of maintenance or additions to the device. Now when you look at a Swiss Knife, you will discover that it is closed for modification since there are no visible ways to open it, nor there are any screws to unscrew. But, when you look at the key ring of a Swiss knife which is a major feature to it, you can see that is has an extension to it. This shows that a Swiss knife is open for extensions and closed for modifications, hence this principle of design can be applied to it.

3. Liskov-Substitution Principle

The LSP principle states that, "You should be able to use any derived class in place of a parent class and it should behave in the same manner with no modification." This principle is almost same as the Open Closed Principle and is applicable to a Swiss Knife's design. This is because it is basically an extension of the Open Closed Principle and states that the new functions should not disrupt the functions of a parent function which was installed before it.

4. Interface Segregation Principle

"Clients should not be forced to depend on interfaces they do not use." This is what the principle of interface segregation delivers. This principle divides the functions into different groups of responsibility and assigns different tasks to them so that the user does not have to buy a large interface and use the functions that it does not need. The functionality of the object is clearly defined according to this principle of design. This principle of design fails to apply on a Swiss knife because it is multi-tasking tool which not only works as a knife but also a nail file, screwdriver and various other things.

5. Dependency Inversion Principle

What this principle of design says that is that," Classes should depend on abstractions for their dependencies." This principle promotes flexibility within a system by making sure that it does not only implement one task at a time. The two main dependencies that a Swiss knife has are its sharpeners and its operator. This principle promotes the object to function on abstractions rather than the concrete evidences. The Swiss knife does function on abstractions rather than the concrete details. It does not matter where your blade is being sharpened or who is using the knife, it could be a dog, a child, an adult or an old person and the knife will still perform its functions.Hence, this principle of design is applicable on a Swiss Knife.

About Shootout

Originally shootout was all about (you guessed it) basketball. However as time passed by it didn't get updated that frequently and in the end, well, hardly ever anymore.

My interests changed and these days I'm all about separating crap from quality, especially online. The spam I have seen over the years is just incredible. So, just for my and maybe also your reference I decided to publish some of my findings here. I hope it can be of help...