پی اچ پی

قوانین ساده برای کد های ساده تر

Simple Rules for Simpler Code

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.

سطح متوسط 5 جلسه آموزشی 00:53:00 ساعت
01
قسمت 1

No Abbreviations

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

02
قسمت 2

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!

03
قسمت 3

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.

04
قسمت 4

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,

05
قسمت 5

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.

دوره در حال اجرا

این دوره هنوز به پایان نرسیده است و در آینده درس های دیگری به آن افزوده خواهد شد.