Thursday, January 30, 2020

TDD - I hate if I do not follow my own rules.

TDD or Test Driven Development is one approach for creating new software, modules, classes or whatever you need in your application.

The main idea behind this is to write your unit-tests first and then your productive code. Sometimes you need to change your tests because while developing the business stuff, you get new ideas on how you get the results you need. But this's fine.

Every time I do consulting in other companies or in my Delphi talks, I tell everybody: "Do your test first, because your development is much quicker" - "And you feel better" - "If every test is green (OK) you can ship the application".

There were complicated classes in the past for my FDK - it had taken more than twice the time to develop them if I hadn't used TDD. And yes, if you do the tests first, it will save you time. So far, so good. Of course, I don't follow my own rules 100% of the time. Sometimes it feels like - this is so simple; I don't need a test for this... In most cases, this is correct - not good, but correct. 

Nearly every app has a point where you have to do more complicated things and like to do some unit-testing. Maybe not for the first release, but if you or your users find the "first" bug, it would be nice if you could write a test to reproduce the bug. Then fix the bug and confirm your test with the OK from your unit-test.

Here's the problem. While creating the unit-test-project you notice, that you have more dependencies in your application than expected. Just one little test and you need to link 90% of the app. Horrible! If you've done the tests first hand, you probably had used more dependency injection. Changing that later is a real pain.

And then?

Your first look into your source code - OMG - What have I done... Yes, I found the problem, but are there any side-effects? Home much unit-test coverage do you have?

OK, Frank - Next time write your tests first..!

Yes, this is an old app from the time where I do not have an MVVM-Framework, but this is no excuse!

Site note:   Assert(TThread.CurrentThread.ThreadID = MainThreadID); it Is very helpful if you are using threads - and I hope with FMX you do everything you can do in a background thread! - Because you sometimes use a class or anonymous procedure in an event from a thread, you haven't done before.

Saturday, January 18, 2020

I wiped my development brain!

Holiday time... Brain-wash time...

On my last holiday I had no PC / Notebook with me. Just my phone - of course...

But my fear was to forget the necessary parts I want to develop/fix/build in the next month. So I took a notebook (paper) and a pen and wrote down some ideas.

Every day I had some topics to write down... The interesting part was I found many topics - like new functions for my FDK that could be used in many old and coming projects. Same with a function that I need for an actual project could also fit in an app that I will start in the next few months. I just wouldn't have noticed that from memory.

After some days of reading the notebook and adding hints, there was a point where I read for hours but did not add anything. So I put this notebook into my nightstand and I felt that my brain was completely wiped of development thoughts.

At this point the real holiday starts - interesting - I hadn't had this kind of empty brain feeling for many years.

So back home - I really want to keep this feeling... But how. At first, I only read the topics from this notebook that are marked as "todo first". I did not read any development related topics - so far. wow...

I use JIRA for my main applications as a ticket system, but for project coordination I never used any software/website. (As I mentioned in the last blogpost "Time-Shared Development Part II".

I googled very hard to find an app at a reasonable price, but I found NOTHING. So if you are using a nice software for this use case, please leave me a comment or/and please fill out my survey!

I do not want to fill my brain with all the stuff from this notebook - I really want to use a software like: "I have 3 hours, what is the most important part I could develop in the time frame?"  or "Give me a list of methods I need most for most of my actual and upcoming projects, order by the estimated time of development"  or "Are there any classes I have to develop for the next release of my apps".

I'm really short of doing the perhaps most stupid decision - New / FMX App / Save as "Project H"...

I hope I have enough important things to do and in the meantime find a solution for my project management...

OR

Perhaps you are also looking for a solution and many other developers, too... So we could start "Project H" together... Or you like to buy this kind of software for you or your team... Try to convince me to start this project...

There are 3.5 Mio Delphi developer out there - if just 1% would love to have this sourcecode for x €.

That would help... ;-)

Or my first open source project? Please help me with this survey!