Object-Oriented Design for your STUPID code

Posted by on December 9, 2012

Your code is STUPID! My code is STUPID!

Almost all of the code around the world is STUPID!

And if you get offended, is a good thing.

I know nobody likes to hear their code is STUPID. Me neither!

But you have to swallow your pride.

Dont get me wrong, i´m saying that your code is STUPID, not you!

How to detect if your code is STUPID?

What characterizes STUPID **code? What makes code **STUPID?

STUPID

  • S ingleton
  • T ight coupling
  • U ntestability
  • P remature Optimization
  • I ndescriptive Naming
  • D uplication

If you can find those patterns in your code, then your code is STUPID.

How to make your code don’t be STUPID?

To achieve this, what you need is a SOLID GRASP!

Yes! SOLID ** and **GRASP

A collection of Object-oriented design principles for “good code”.

SOLID

  • S ingle responsibility principle
  • O pen/closed principle
  • L iskov substitution principle
  • I nterface segregation principle
  • D ependency inversion principle

GRASP

  • G eneral
  • R esponsibility
  • A ssignment
  • S oftware
  • P atterns (or Principles)

The different patterns and principles used in GRASP are: Controller, Creator, Indirection, Information Expert, High Cohesion, Low Coupling, Polymorphism, Protected Variations, and Pure Fabrication.

With that information, its time for SMART coding!