Antoine de Saint-Exupéry wrote in his book The Little Prince the following phrase:
“Perfection is Achieved Not When There Is Nothing More to Add, But When There Is Nothing Left to Take Away”
Thinking about this small sentence, I would like to share with you some small considerations applying it in software development.
Simplicity is the most complex thing
Think about software development. Many developers tend to create complex architectures, adding unnecessary patterns or over engineered code. Why they do that? Because they are trying to set the path for future changes that is gonna happen almost…never!
For example: you choose to abstract a component usage – by using IoC, for example – because, maybe one day, you must be able to use a different component and you don’t wont to change every time your code. Nice and good practice! But, it is really necessary in a iOS app? Maybe yes but, really, how many times you’ll change that component in the app lifetime? Except for really rare case, from zero to one time.
So, in that case, abstraction it’s like to take “a sledgehammer to crack a nut“.
Lets evolve your architecture
When your requirements are really not clear at first, write the most simpler code. If you need to read data from database, try to create a simple interface with direct read. This is not so bad at all. When you need to access to the database from another point or view, change your architecture by refactoring your code to create your data access layer.
The idea is simple: introduce changes in your architecture as late as possibile and only if it is strictly necessary. You can’t predict the future, so don’t do unnecessary things.
Obviously, if your requirements are clear, keep in mind your architecture while developing!