MicroObjects

MicroObjects (originally µObjects) is my summarization of how to write maintainable Object Oriented code that is highly resistant to code rot.
MicroObjects help your code be more maintainable through many best practices being inescapable. A couple of these are that objects become inherently thread safe and emergent design and evolutionary architecture is unavoidable.

Through the information presented; MicroObjects' benefits will be discussed and examples of refactoring into MicroObjects will be demonstrated.

Driving principle

Have a representation for every concept that exist in the code.

Part 1 - Part 2 - Part 3 - Part 4

The Technical Practices of MicroObjects

  • No Getters (or Setters)
  • Be immutable
  • Interface for Behavior Contracts
  • Abstract 3rd Party Code
  • No Public Statics
  • If Only as a Guard Clause
  • Switch and Else are always evil
  • No Nulls
  • No new inline
  • Extract Cohesion
  • Composition over Inheritance
  • No primitives
  • No enums
  • No logic in constructors

Why?


CLEAN Code


Examples

I'm always trying to improve how I write code. As such, exactly how my implementation of MicroObjects goes changes over time. Check the dates on the last commit of these; the further back they are, the more likely I do stuff a little different.

Example implementations of microobject concepts
https://github.com/Fyzxs/DeliverAgileFizzBuzz
https://github.com/Fyzxs/FractionalMath
https://github.com/Fyzxs/HackerNewsReader
https://github.com/Fyzxs/microBattleshipFirst
https://github.com/Fyzxs/MicroObjectMagicTheGathering
https://github.com/Fyzxs/MicroObjectPizzaShop
https://github.com/Fyzxs/microObjectsBowlingRefactor
https://github.com/Fyzxs/MicroObjectsCalculator
https://github.com/Fyzxs/MicroObjectTicTacToe
https://github.com/Fyzxs/MicroObjectUiExample
https://github.com/Fyzxs/MicroPlayingCards
https://github.com/Fyzxs/PomodoroTimer