3 Key Software Principles You Must Understand

3 Key Software Principles You Must Understand

Tutorial Details
  • Program: All
  • Difficulty: Intermediate
  • Estimated Completion Time: 30 Minutes

If you’re in software development, new techniques, languages and concepts pop up all of the time. We all feel those nagging doubts every now and then: “can I keep up with the changes and stay competitive?” Take a moment, and sum a line from my favourite movie, Casablanca: “The fundamental things apply, as time goes by.”

Republished Tutorial

Every few weeks, we revisit some of our reader's favorite posts from throughout the history of the site. This tutorial was first published in April, 2012.

What’s true for love, is true for code.

What’s true for love, is true for code. The fundamental things will always apply. If you have an understanding of the underlying ideas of software development, you will quickly adjust to new techniques. In this tutorial, we will discuss three basic principles and mix them with many more. They provide a powerful way of managing the complexity of software. I’ll share some of my personal opinions and thoughts, which, hopefully, will prove useful when it comes to applying them to code and real-world projects.


Principle – Don’t Repeat Yourself

A basic strategy for reducing complexity to managable units is to divide a system into pieces.

This principle is so important to understand, that I won’t write it twice! It’s commonly referred to by the acronym, DRY, and came up in the book The Pragmatic Programmer, by Andy Hunt and Dave Thomas, but the concept, itself, has been known for a long time. It refers to the smallest parts of your software.

When you are building a large software project, you will usually be overwhelmed by the overall complexity. Humans are not good at managing complexity; they’re good at finding creative solutions for problems of a specific scope. A basic strategy for reducing complexity to managable units is to divide a system into parts that are more handy. At first, you may want to divide your system into components, where each component represents its own subsystem that contains everything needed to accomplish a specific functionality.

For example, if you’re building a content management system, the part that is responsible for user management will be a component. This component can be divided into further subcomponents, like role management, and it may communicate with other components, such as the security component.

As you divide systems into components, and, further, components into subcomponents, you will arrive at a level, where the complexity is reduced to a single responsibility. These responsibilities can be implemented in a class (we assume that we’re building an object-oriented application). Classes
contain methods and properties. Methods implement algorithms. Algorithms and – depending on how obsessive we want to get – subparts of
algorithms are calculating or containing the smallest pieces that build your business logic.

The DRY principle states that these small pieces of knowledge may only occur exactly once in your entire system.

They must have a single representation within it.

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

Note the difference between the piece of knowledge, and its representation. If we’re implementing the database connection in our CMS, we will have a code snippet that will initalize the database driver, pass the credentials, and save a reference to the connection in a variable. The code snippet is part of the knowledge, it’s about how something is achieved. The variable with the reference to the connection is the representation of that knowledge – and this can be used by other parties. If the database credentials change, we will have to change the snippet – not its representation.

In a perfect application, every small piece of business logic encapsulates its knowledge in a representation, namely a variable or a class property.
This variable itself is encapsulated in a class that can be described as a representation of a responsibility. The class is encapsulated in a component that can be described as a representation of functionality.

This can be proceeded until we reach the top level of our software project – that is, a stack of representations with increasing complexity. This way of looking at the complexity of software is called modular architecture, and DRY is an important part of it.

Software architecture is about managing complexity.

Achieving DRYness

DRY is a philosophy that packages logic into representations.

There are many ways of achieving DRYness. Hunt and Thomas suggested (among other things) code generators and data transforming. But, essentially, DRY is a philosophy that packages logic into representations.

As every part of your application can be seen as representation, every part exposes specific fragments of your underlying logic: The user management exposes access to registered users of the CMS, the user class represents a single user and exposes his properties (like the username). It retrieves the properties, via the representation of the database.

DRY and modular architecture require good planning. To achieve a representational hierachy from bottom-up, divide your application in a hierarchy of logically separated smaller parts and let them communicate with each other. If you have to manage larger projects, organizing them into components and using DRY within the components is a good idea. Try to apply the following rules:

  • Make a visual hierarchy of your software application and map the main components to it. Complex projects may require a dedicated map for each component.
  • If you’re arriving at a level of connected responsibilities, you may want to switch to UML diagrams (or similar).
  • Before writing a chunk of code, name its hierarchy in your software project. Define what it’s representing, and be sure you know its role in the surrounding component.
  • Define what the representation should expose to other parties (like functions to execute SQL in a database driver) and what it should hide (like the database credentials).
  • Ensure that representations do not rely on representations of another complexity level (like a component that relies on a class in another component).

The database driver is a simplified example, as there are many more layers involved in the real world (such as a specific database abstraction layer), and there is much more you can do to encapsulate logic – especially diving into design patterns. But even if you’ve just started with coding, there’s one thing to keep in mind:

When you find yourself writing code that is similiar or equal to something you’ve written before, take a moment to think about what you’re doing and don’t repeat yourself.

In the real world, applications that are a 100% DRY are hard, if not impossible, to achieve. However, applications that are unDRY to an unacceptable degree – and therefore hard to maintain – are quite common. Hence, it’s not surprising to learn that more than 50% of all software projects fail – if you’re taking a look at the code.

Many people tend to think that bad code is produced by bad coders. In my experience, this is very much an exception. More often than not, bad code is produced by bad account managers and an overall misconfiguration of process management in companies.

Bad code is rarely produced by bad coders.

An Example

DRYness is achieved by good planning.

As an example, say you’re hired as a technical consultant by a company that has problems with code quality and maintenance. You review the source and you see hacks and code duplication – the code is not DRY. This is a symptom of bad code quality, it’s not the reason. If you take a look at the version control system – aka the history of the code – chances are that you may find hacks that were introduced at times near deadlines and milestones. Take the time to review what changes are made, and you will likely be confronted with a change in requirements.

As noted above, DRYness is achieved by good planning. Forced changes on a tough deadline are forcing developers to implement dirty solutions. Once the code is compromised, the principle of DRY is likely to be sacrificed completely upon further changes.

There’s a reason why the most successful corporations in the IT business were founded by people with very good technical understanding – or even coders themself: Bill Gates, Mark Zuckerberg, Steve Wozniak, Steve Jobs, Larry Page, Sergey Brin and Larry Ellison know (or knew) what efforts are needed to implement something. Contrary, many companies tend to lay the requirements for engineering into the hands of account managers, and the conceptual part in the hands of business consultants…people who have never implemented anything.

Hence, many technical concepts work only in Powerpoint, Photoshop, and on 27″ widescreen displays. This may have been a successful approach in the days of, more or less, static websites, but it’s not nowadays – with interactive applications on multiple devices. Because coders are the last in the line, they are the ones who have to apply quick fixes on errors in the concept. If this is accompanied by an account manager, who can’t stand up to a client that likes to make last-minute changes, plans are thrown in the garbage, and something quick and dirty is implemented. The code becomes unDRY.

This example is a bit extreme (nevertheless, I have witnessed such scenarios), but it demonstrates that DRY is a theoretical concept, which is challenged by various parties in the real world. If you’re working in a company that forces you to work in this manner, you might suggest some changes to the process (like introducing technical expertise at an earlier stage of technical projects).

If you have a hands-off approach, keep reading! The You ain’t gonna need it principle will come to the rescue.


Principle – Keep it Simple Stupid

The simplest explanation tends to be the right one.

In the late 19th century, physicists struggled to explain how gravity, magnetism and optics interact, when it comes to large distances – like the distances in our solar system. Hence, a medium named aether was postulated. It was said, that light is traveling through this medium, and that it’s responsible for effects that couldn’t be explained otherwise. Through the years, the theory was expanded with assumptions that adjusted the aether postulate to the results of experiments. Some assumptions were arbitrary, some introduced other problems, and the whole theory was quite complex.

An employee of the swiss patent office, Albert Einstein, suggested to get rid of the whole aether theory when he introduced a simple, yet revolutionary idea: All the oddness in calculating with large distances would fade away if we’d accept that time is not a constant; it’s relative. This incredibly of out-of-the-box thinking to come to the simplest explanation with the fewest assumptions to select between competing scenarios is referred to as Ockhams’s Razor.

There are similar concepts in many areas. In software development (and others), we refer to it as KISS. There are many variants for this acronym, but they all mean that you should strive for the simplest way of doing something.

Substantial progress in the history of mankind was achieved by lateral thinkers.

HTTP

The Hypertext Transfer Protocol is widely considered to be a perfect example for a simple solution: designed to transfer hypertext based documents, it is the backbone of highly interactive and desktop-esque applications nowadays. Maybe we have to find solutions for limitations in the protocol, and maybe we have to replace it someday. However, status quo is: based on a few request methods (like GET and POST), status codes and plain text arguments, HTTP has proved to be flexible and robust. That’s why HTTP has been repeatedly pushed to the limits by web developers – and is still standing.

We take this approach for granted, but the history of software development and standardization is full of overly complex and half-baked solutions. There’s even a dedicated made-up word for it: bloatware. Software like this is also described to be DOD, dead on arrival. I have a theory that is very similar to my theory of unDRY code, when it comes to bloatware … However, the success of the internet can be described as a success of simple, yet efficent solutions.

So what’s required to come to the simplest solution possible? It all comes down to maintainability and comprehensibility in software development. Hence, KISS kicks in during the phase of requirements engineering. When you think about how to transform a client’s requirements to implementable components, try to identify the following parts:

  • Functionality that has an inappropriate ratio between benefit and efforts.
  • Functionality that is highly dependent on other functionality.
  • Functionality that is likely to grow in complexity.

There are many people involved in the conceptual process, who do not have the technical expertise to make a reliable cost-benefit analysis

I was once working on a project, where the client wanted to import Excel spreadsheets into his crew management software. This was a clear match. Excel is a proprietary software with a complex document format. The format is complex, because it’s feature-rich: You can add graphs and other things to it – features that were not needed by the client. He was simply interested in the numbers. Thus, implementing the Excel import would require the implementation of a lot of unnecessary functionality. On top of that, there are multiple versions of Excel versions, and Microsoft fires off another release each year. This would have been hard to maintain, and it comes with additional costs in the future.

We ended up implementing a comma-separated-value import. This was done with a few lines of code. The overhead of the data was really small (compare an Excel sheet to it’s CSV equivalent) and the solution was maintainable and future-proofed. Excel was ready to export CSV anyway (as well as other programs that the client might want to use in the future). Since the solution was low-priced as well, it was a good application of the KISS principle.

To sum up: try to think out-of-the box if a task looks complicated to you. If someone is explaining to you his requirements, and you’re thinking that it’ll be tough and complex to implement, you’re right under almost any circumstances. While some things are just that – hard to implement – overcomplicated solutions are quite usual. This is the case because there are many people involved in the conceptual process, who do not have the technical expertise to make a reliable cost-benefit analysis. Hence, they don’t see the problem. Double-check the requirements whether they are really stripped down to the essence that the client needs. Take the time to discuss critical points and explain why other solutions might be more suitable.


Principle – You “Ain’t Gonna Need It

Coding is about building things.

When Google+ launched, Mark Zuckerberg – founder of Facebook – was one of the first who created an account in the social network that was aiming to take his own down. He added just one line to the About me section: »I’m building things.«. I honestly think that this is a brilliant sentence, because it describes the pure essence of coding in a few simple words. Why did you decide to become a coder? Enthusiasm for technical solutions? The beauty of efficiency? Whatever your answer is, it may not be »building the 1.000.001th corporate website with standard functionality«. However, most of us are making money that way. No matter where you are working, you’ll likely be confronted with boring and repetitive tasks every now and then.

80% of the time spent on a software project is invested in 20% of the functionality.

The You ain’t gonna need it principle (YAGNI) deals with these tasks. It basically translates to: If it’s not in the concept, it’s not in the code. For example, it’s a common practice to abstract the database access in a layer that handles the differences between various drivers, like MySQL, PostgreSQL and Oracle. If you’re working on a corporate website that is hosted on a LAMP stack, on a shared host, how likely is it that they will change the database? Remember that the concept was written with budget in mind.

If there’s no budget for database abstraction, there’s no database abstraction. If the unlikely event of a database change does occur, it’s a natural thing to charge for the change request.

You may have noticed the difference between You ain’t gonna need it and DRY-driven modular architectures: The latter is reducing complexity by dividing a project into manageable components, while the former is reducing complexity by reducing the number of components. YAGNI is similar to the KISS principle, as it strives for a simple solution. However, KISS strives for a simple solution by trying to implement something as easily as possible; YAGNI strives for simplicity by not implementing it at all!

Theodore Sturgeon, an American sci-fi author, stated the law: »ninety percent of everything is crap«. This is a very radical approach, and not overly helpful in real-world projects. But keep in mind that “crap” can be very time consuming. A good rule of thumb is: roughly 80% of the time spent on a software project is invested in 20% of the functionality. Think about your own projects! Everytime I do, I am surprised by the accuracy of the 80:20 rule.

80% of the time spend on a software project is invested in 20% of the functionality.

If you’re in a company that is notorious for tight deadlines and imprecise concepts, this is a powerful strategy. You won’t be rewarded for implementing a database abstraction layer. Chances are that your boss does not know what a database abstraction layer even is.

While this concept may sound simple, it can be hard to differ the necessary from the unnecessary parts. For example, if you’re comfortable with a library or a framework that uses database abstraction, you won’t save much time in dumping it. The key concept is another way of looking at software: we’re trained to write future-proof and maintainable software. This means that we are trained to think ahead. What changes may occur in the future? This is critical for bigger projects, but overhead for smaller ones. Don’t think into the future! If a small corporate website does fundamental changes, they may have to start from scratch. This is not a significant problem compared to the overall budget.

Planning a Project

When you’re preparing your to-do list for a project, consider the following thoughts:

  • Achieve lower complexity by reducing the level of abstraction.
  • Separate functionality from features.
  • Assume moderate non-functional requirements.
  • Identify time consuming tasks and get rid of them.

Let’s go a little bit into detail! I already provided an example for the first item in the list: don’t wrap a database driver around a database abstraction layer. Be suspicious of everything that adds complexity to your software stack. Notice that abstraction is often provided by third party libraries. For example – depending on your programming language -, a persistence layer, like Hibernate (Java), Doctrine (PHP) or Active Record (Ruby) comes with database abstraction and object-relational mapping. Each library adds complexity. It has to be maintained. Updates, patches and security fixes have to be applied.

We implement features everyday, because we anticipate them to be useful. Hence, we think ahead and implement too much. For example, many clients want to have a mobile website. Mobile is a term of wide comprehension; it’s not a design decision. It’s a use case! People who are using a mobile website are, well, mobile. That means they may want to access other information or functionality than a user who visits the site laid back at his desktop. Think of a cinema site: Users on the bus will likely want to access the starting time of upcoming movies, not the 50 MB trailer.

Bad concepts can often be identified by the lack of non-functional requirements.

With an appropriate budget, you would perform a dedicated analysis of the requirements for mobile. Without this analysis, you will simply provide the same information as is on the desktop site. This will be just fine for many circumstances! Because mobile browsers are very clever in adjusting desktop sites to their display, a radical YAGNI approach might be to not write a mobile site at all!

Non-functional requirements do not describe behaviour of a software, they describe additional properties that can be used to judge the quality of software. Since describing software quality presumes knowledge about software, bad concepts can often be identified by the lack of non-functional requirements. Maintainability, level of documentation, and ease of integration are examples for non-functional requirements. Non-functional requirements should be measurable. Hence, »The page should load fast.« is too inconcrete, »The page should load in two seconds max during an average performance test.« is very concrete and measurable. If you want to apply the YAGNI principle, assume moderate non-functional requirements if they are not mentioned in the concept (or if they are mentioned, but inconcrete). If you are writing the non-functional requirements yourself, be realistic: A small corporation with 20-50 page visits a day does not require three days of performance tweaking – as the page should load fast enough because the server is not busy. If the corporation can increase the number of daily visits, a better server or hosting package shouldn’t be too expensive.

Last, but not least, remember the 80:20 rule-of-thumb!

Last, but not least, remember the 80:20 rule-of-thumb! We have to identify the time consuming parts. If a part is absolutly necessary, you have to implement it. The question should be: how will you implement it? Does it have to be the latest framework with a small community? Do you need to switch to the just-released version of a library if the documentation is not up to date? Should you use the new CMS, when not all extensions are available? How much research will be necessary to do so? »That’s the way we have always done it.« is not an exciting approach, but it’ll get the job done without surprises.

It’s important to understand that all of this does not mean that you can start writing dirty code with hacks along the way! You’re writing a lightweight application, not a messy one! However, You ain’t gonna need it is a practical approach. If it would cause many lines of code to reduce a few lines of code duplicates, I personally think that you may relate efforts to budget and some unDRYness is ok. It’s a small application. Hence, the added maintenance complexity is acceptable. We’re in the real-world.

Let’s come back to the inital thought: we like building things. When Beethoven wrote the Diabelli Variations, it was contract work. I don’t think he made compromises on budget. He ran the extra mile, because he did not want to write average music; he wanted to write a perfect composition.

I’m certainly not implying that we’re all geniuses, and that our brilliance should shine through every line of code, but I like to think of software architecture as compositions. I’m a passionate developer, because I want to build perfect compositions, and I want to be proud of the things I’m building.

If you want to be an experienced and business-proofed developer, you have to master the You ain’t gonna need it principle. If you want to keep your passion, you have to fight against it every now and then.


Summary

Software principles are a way of looking at software. To me, a good principle should be based on a simple concept, but it should evolve to a complex construct of ideas when confronted with other techniques and philosophies. What are your favourite software principles?

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • Simone Scarduzio

    This is really wise and realistic.
    Last part boils down to: quality and performance are optional features to be sold for good money and just when it’s required.

    I couldn’t agree more, it’s a lot of work.

  • http://reconnect-inc.com David D’hont

    I have come to this conclusion a long time ago, I release most of my re-usable components on Codecanyon. I know that the world doesn’t reward perfectionists, but people who gets things done.

    But in the end, I will be the one who has to write less code rather then repeating myself all the time. Maybe the world doesn’t reward perfectionists. But if you get things done faster because of these components, then in a way, it’s worth the trouble.

    • http://digitale-avantgarde.com Chris
      Author

      Yepp. “Know your tools.” would be a good point to add to the “Planning a project” list.

  • Matt

    Awesomely wise and intelligent. Great work Envato. A must read for all code hounds.

  • http://silvercover.me silvercover

    I have a personal quotes in my everyday conversations in which I say that “Simplicity is the Results of Complexity”. I know you may heard it from hundreds of people in history, but that’s quite true and I believe it as a pillar. I reach to above saying by experience.

    When you are experienced and conclude to a simple solution, then most probable you examine or think about other complex solutions over the times. this approach gradually makes you believe KISS principle.

    Thanks for this valuable article.

    • http://prophpvn.com Hudson Nguyen

      I like your quote. It’s not at the coding level only but for me, in the way I am struggling with designing my application and choosing which features it should have.

  • William Smith

    Very nice. Thank you.
    Along with the 80/2- rule as presented above, I have a corollary usage:
    80% of the users of your application use only 20% of its features.
    And there is usually a lot of overlap among the users of which 20% they use. In other words the other 80% represents some measure of bloat.
    The KISS principle reminds us to check when a new requirement is created: is this going to be in the 20% (used features) category or are we adding to the 80% (bloat) category.

  • Martin

    I have followed nettuts+ since the beginning and have read or at least skimmed over almost every article, even when it wasn’t relevant to my interests.

    So I have to say that this is one of the best articles I’ve seen on any of the tuts+ sites. We drown ourselves in trends, frameworks and languages but forget the most important thing, the key to everything: fundamentals and basic software design principles. As long as you have that, picking up new languages, skills and growing as a developer is much, much easier.

    Thank you Chris.

  • PapePathe

    Good Technical Article. Waiting for the next tip!!!

  • Fritz Lekschas

    Great article! Thanks :)

  • http://sagie.es Cesar

    Fantastic article. Keep it up!

  • https://www.box.com/s/9f151e007f8389e7d546 Terry Rubio

    Good article!thanks a lot for the information!

  • http://www.studioultimate.com Avinash

    Very True and Well written.
    The structure and pattern of your application / site / program (whatever) defines most of it. If you write it crappily be ready to rewrite it SOON .

  • Alex

    This is a very inspiring article. I have constantly battled with delivering quality software/going over the top when delivering solutions according to a specific budget. The YAGNI principle helps tremendously.

  • Garrafote

    Very nice article,

    Thank you!

  • Sergey

    Great article! So glad to see this kind of content on nettuts:)

  • http://terrencebowman.com TJ

    Excellent article. Very informative!

  • Chris M.

    Good article for inspiring quality work, at least that’s the effect it had me!

    I did notice a couple typos under HTTP Section “…DOD, dead on arrival…” I think you mean “DOA.” Also I don’t believe Steve Jobs ever wrote a line of code in his life, he’s might be considered more of an ‘honorary programmer.’

    • http://digitale-avantgarde.com Chris
      Author

      Yes, it’s a typo. Should be DOA.

      Steve Jobs is the reason I wrote “… have a very good technical understanding, or even coders themself.” He was definitly the first, but you’re right, not a coder. That’s why I listed the other Steve of Apple, Wosniak, too. An unbelivable talented programmer,

      • Abhijit

        That goes on to show that good business sense is equally important to bring up those kind of organizations. (I know this is kind of off-topic, just felt like writing!)

    • http://www.telecommutetojuryduty.com/ Dominick

      just noticed this too—hasn’t been fixed yet :/

      but enjoying the post so far; well written!

  • Raptor

    In my experience, DRY is not as much as a problem as people overdoing DRY. I have many times seen code factorisation that leads to more code or more complex code than if it wasn’t factored in the first place. There is a balance to strike and when you want to share code between projects, you have to be sure it is worth it, and not making the code less maintainable.

  • Stephen

    I really enjoyed reading this article. very well laid out and great tips for newbie like me to the world of programming. :)

  • http://asdfg.me hansi

    @Raptor: i thought the same thing. DRY and KISS are mutually exclusive sometimes.

  • http://abetobing.com Abe Tobing

    This article is a true-quality !

  • creage

    Took a responsibility of translating this nice article in Russian here http://habrahabr.ru/post/144611/.

  • Alan

    “In the real world, applications that are a 100% DRY are hard, if not impossible, to achieve.”

    This is a funny statement. It makes it sound like there’s something implicit in DRYness that makes it hard to achieve, when in fact, there’s almost nothing easier. I’ve never had any trouble reducing repetition of any kind in real systems, provided we’re using a sufficiently high-level language.

    And that’s the catch, which you omitted. Most “real world” (ha) applications are written at companies that have policies dictating what languages you can use, and these languages are too low-level to allow for fully DRY code. The problem is not DRY, but programming language choice, and hence, company politics.

    If your language doesn’t have closures and quoting, DRY is going to be impossible to achieve without writing your own runtime to simulate these features. If your language has those but doesn’t have syntactic abstraction, DRY is going to be possible but will be so verbose nobody is going to bother (as per your third principle, YAGNI).

    That’s why XML is so popular with Java/C# programmers: it’s the path of least resistance to your own parser. (Except now you’ve written your own mini-language in XML, which is 90% redundant with every other XML mini-language.)

    That’s also why stating these principles is so popular in low-level languages: because doing it takes so much work. You don’t hear Ruby or Lisp or Smalltalk or Io programmers saying “DRY!”, because in those languages, when you clean up code to make it smaller and simpler, it naturally becomes DRY.

    That’s why the enemy of DRY (as you point out) is often seen as “last-minute fixes”, and the answer becomes “more process”. But this is only needed because the DRY fix to an O(1) problem is an O(n) change in a low-level language; when the DRY (correct) fix is an O(1) change, extra process is pointless.

    It’s a little surprising (and a little disappointing) that people with lower-level languages never put the pieces together: “DRY is a good universal principle” + “my programming language makes DRY hard”. So why not switch languages? I used to think it was as simple as bureaucracy: it’s easier to refactor bad Java code indefinitely than it is to convince a PHB to switch away from Java. But if everybody was clamoring for a higher-level language, it would probably happen, so that’s probably not the real reason.

    Perhaps people rank “YAGNI” higher. Programmers who started out on C-derived languages tend to stay there, and if they follow YAGNI when choosing languages, then they would have to see a very big picture indeed to understand how this hurts their attempts at DRY.

  • Guest

    unDRY? wet!

  • http://think360studio.com/ Think360studio

    Hi chris. I totally agree with you. I also consider that a software should be simple so that it would be easy to use. Being a Designer i always prefer easy software so that any project of mine will consume less time.

  • Mika Andrianarijaona

    Thanks for this post. It was really helpful and I have just discovered the YAGNI principle. It’s 100% true, we generally implement things that are will likely not be used and the client won’t even be aware either it was implemented or not. I will think twice now before implementing code ;)

  • Corey

    We should call unDRY code WET code Written Every Time

  • http://www.maiconweb.com Maicon Sobczak

    Massive well explained concepts. I apply the KISS in every project and am learning the DRY.

  • http://magpiewebsitesolutions.co.uk steve graham

    The problem with DRY is that should you have to change that database extraction class that is called by 20 other functions then you have to test each and every function. If however you split the database extraction class into 4 parts then you only have to test 5 functions.

    As an example we have separate extraction methods depending on how the data should be sorted rather than passing the sort type into one method.

    As you say, DRY can cause complexity.

    • Angelo

      DRY makes sense is some cases, NOT in all cases.

      The whole point of DRY is to have less maintenance and less potential for bugs by having less code. When you start over complicating your code to accommodate DRY, that’s when it makes more sense to duplicate logic. Less code does not automatically mean simpler and easier to maintain code. In many cases it can make sense to ignore DRY. Code that is intuitive and easy to understand trumps more efficient, lightweight or elegant code in many cases. It all depends on what your priorities are.

      Use a philosophy/methodology/design pattern only to the point where it’s beneficial. Don’t ever stick with something that isn’t adding value simply because it’s the “right” way to do it or for the sake of being 100% consistent throughout your application.

      Those are BS, idealistic justifications that have no place in a successful business. Good is always better than perfect if you want to make money.

  • http://dagrevis.lv/ daGrevis

    Awesome read! No comments.

  • http://www.daquanwright.com Daquan Wright

    If you’re running a business, it’s only logical that you need good business practices.

    Same goes with good programming practices. I like these tips!

  • Alex

    Thank you! This will help a lot in my upcoming project :)

  • http://infinity-plus.co.uk Sando

    Great article and it covers the main and most important points of software development.

    Often problem is when clients don’t know what they want and usually thet start throwing new features in already started project with agreed development plan. Hence that’s good place to use the YAGNI approach and just fight back your client but explain why this feature shouldn’t be developed which could be, mainly, impact over budget or bloating the application which could drive back the users.

    And most important keep balance above all of it (Client, Budget, Users)

  • http://amajsaz.ir/fa/1/Decoration Decor dakheli

    thanks for an awesome update and This will help a lot

  • http://dice.wordpress.com kanuj bhatnagar

    I’ll completely agree on the YAGNI method. For years I’ve built CMS sites for clients, complete with an admin section to allow them to edit their pages as they see fit, only to have them email me every other day to change the font, add a one liner, add a new line etc. Yes, it becomes frustrating after a while, to the point you consider why you used a server side language in the first place. To which I think that the only reason we even make CMS sites these days is to make our job easier, and to not open up a FTP and edit HTML pages for a client’s each demand. I’d rather use the WYSIWYG editor I put in, than to edit each file by hand.

  • http://mckoycleaninggroupllc.com/RoxanaG Vance

    Hi, I do think this is an excellent site. I stumbledupon it
    ;) I’m going to return yet again since I book-marked it. Money and freedom is the best way to change, may you be rich and continue to help others.

  • http://finestandroid.com/ Biala

    Unfortunately these words are true only for students or beginners who were never involved in planning, running, supporting and team leading in a really big project. Planning is good but too much planning is bad and too much of code encapsulation can be a killer. Hope you will remember this!

  • http://www.insightcoder.com Richard

    I really liked this article. In fact, I would suggest Chris to change the title to “3 Key Software Principles Every Developer Needs to Know”. I strongly believe in these principles, however, I have to say sometimes due to time constraints or improper project management, we tend to forget about this. We get too caught up in the “we got to get this done and release this product” mentality.

  • http://medianotions.de Bogdan Günther

    Great Article! I especially had to think about the »ninety percent of everything is crap« quote :-)

  • http://www.brookswebdesign.net Maria

    Principle #1 “Don’t Repeat Yourself” and #2 You “Ain’t Gonna Need it”, were pretty easy for me to adapt from the get go. The KISS principle is one I learned over time. It’s funny how you go back and look at code you wrote 6 months to 1 year back and can plainly see how you could have simplified it! Good article, we can all use reminders like these

  • Wel Marquez

    I like how you referenced Albert Einstein and Beethoven to give emphasis on some points there. Great read.

  • http://wpmonkeys.com/ Banhawi

    “Keep it Simple Stupid” that how should we all code, simple stupid :D, no need for complexities.

  • Bhagwant

    Nice article, Thanks a lot :)

  • Jack

    Very nice!