Simple Rules for Simpler Code

0
Language

Level

Beginner

Access

Paid

Certificate

Paid

If you’ve ever heard a developer use the term, “object calisthenics,” you might have assumed that they were referring to some hugely complex topic. Luckily, though, that’s not the case. It simply refers to a series of coding exercises to promote better software.

Add your review

No Abbreviations

Let’s begin with a simple rule: avoid abbreviations. Nearly all beginning developers break this one at some point or another.

Don’t Use “Else”

Is it possible that the else condition within that method of yours is either unnecessary or redundant? I bet the answer is yes! If so, get it out of there!

One Level of Indentation

I know what you’re thinking. One level of indentation? That’s impossible! Well, are you sure about that? Maybe there are lots of instances, when we can improve the design of our code by adhering to this guideline.

Limit Your Instance Variables

As we work in PHP, we’ll need to tweak this next guideline a bit. Jeff Bay, the creator of these exercises, recommends that, at most, your classes should contain two instance variables. Let’s talk about that a bit!

Wrap Primitives (Sometimes)

The next guideline instructs us to always wrap primitives (things like strings and integers). However, I’m going to caution you on this one. You must first consider the complexity of your app, and the benefits that each wrapper provides.

User Reviews

0.0 out of 5
0
0
0
0
0
Write a review

There are no reviews yet.

Be the first to review “Simple Rules for Simpler Code”

×

    Your Email (required)

    Report this page
    Simple Rules for Simpler Code
    Simple Rules for Simpler Code
    LiveTalent.org
    Logo
    LiveTalent.org
    Privacy Overview

    This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.