In software development, there are often (too) many ways you can solve a goal.
But how do I find the right way?
Perhaps you saw this approach in other sourcecode or at a conference. You downloaded the code from Bitbucket or GitHub... Perhaps you found it in a book…
I often heard:
- It's the Microsoft way - they know how to do things - don't question this.
- This is a pattern - you have to do it by the book - more intelligent people have hammered this in stone
or the other side
- don't use this - it's part of the language, but do not use this (With, FreeAndNIL, Goto)
Who is able to decide what is right or wrong and if it is "marked" as wrong is it so bad to use or do it this way?
Is it really so, that out there are only a very few who set the rules? Yes I think so. I call them Book writers or "Head of the Team". Do not get me wrong - these guys are very talented, and they know how to do things. And for our Delphi?
The count for "Head of the Team" is much smaller than on C, C++ or C#. (btw. from my point of view, all other languages do not count, especially if they do not result in CPU binary code)
But what if you do it in another way, what if you like to do it "called wrong" and what if your way is a better way for you?
My Answer is: Then do it this way.
If your code is still: Readable, maintainable, stable and testable. Compile it, ship it and earn you money.
Why should I do things only by the rule book? - But wait… Perhaps another developer doesn't understand your way and could not use your source or library. Yes, you can write it in your documentation and answer RTFM.
For a good library or component, there is no need to look into the documentation. Is it so? If yes we are all using stuff the is build decades ago… And yes we do, and we're dealing with this every day.
You like a small example? OK, find the bug:
i : integer;
d : TDateTime;
D := now;
while i < 30 do
From my point of view - it is a bug - but the answer is "We don't want to cause problems to existing code" - bug-report closed. So we still have to look at the documentation. I would have been so happy if they have used this answer at implementing Unicode as default into the compiler.
If you are working with a team or writing code that is used by many other developers you have to do things as your audience would expect it. OK... I agree.
But I often like to do things my way because it is - from my point of view - the better way. That's why I have my own MVVP 2.5 Pattern, my FluidCreator or Fluent-Creator, my own Binding and not the visual live binding, do things in code and not in the object inspector, create a database with a creation pattern, have a wrapper for FireDac, a wrapper for AppTheathering, a wrapper for Bluetooth, a wrapper for Streams, a wrapper for exception handling, many wrapper to do threading, IDictionary and normally everything thread-safe…
Perhaps one time in the future - I like to do this since 20 years - I will write a book about this and become part of the "Book writers"...
We will see…
But first I had to travel to a planet with a slower rotation speed!