Wednesday, December 25, 2019

Time shared development Part II - or Project H?

A little bit more than 6 months ago I changed my daily work to "time-shared-development".

Spoiler: This was a good idea...

But as I mentioned, I do not use any software or website to track my projects. Ok - JIRA as a bug-tracker for my two main projects...

There are so many "new" words and websites to handle your agile programming, your development team, and your projects. By doing some googling, you really get overwhelmed by the different approaches. Some are looking not so bad, but most of the systems are much too big for some little project tracking. Most of them have no detailed information on the workflow and of course, all systems/websites want your money as a monthly fee. 

I really, really dislike the tendency to do everything in a browser on a website. No, I hate this! That's why I always use an App if it is available. 

The question is, do I need this? I think the "time-shared-development" is still a very good idea, so let's compare the pros and cons.

Pros

  • Work did not get boring
  • Every day a new task in a different environment
  • If I get stocked on a problem, I could work on a different project and wait for a new idea
  • Other projects are not sleeping and are still improving
  • No induction period in projects that have been dormant for a long time


Cons

  • All projects take more time to be completed
  • The progress (next step/problem) of every project has to be kept in mind.
  • Shared code that has to be used or could be used in more than one project can easily be overseen 
  • Problems can be too simple be pushed aside (see Pros)
  • Progress-points of projects could easily get mixed in mind


So two cons depending on keep the progress and/or the actual problem of every project in mind. For two projects it is doable... But how many projects could you keep track of, without any todo-list? At this point, I'm still not 100% happy with this kind of workflow. Should I start project H and start coding software for this task? How long would it take to develop a usable software? Which are the necessary main features to start with? Is a simple text file on the desktop enough? Or an Excel sheet?

OK, perhaps first take a look at the problem. Of course, I use me FDK for every project and as my MVVM-Plugin is nearly ready, I will use this also for my projects. Some projects must be refactored to this new version of my framework. For new features I always decide if this is a feature - only for this project - or should I write this as a generic Class/Unit for my FDK. Many projects have a partial feature that is similarly usable in other projects after minor changes.

For example, many mobile apps storing data into a local database, if no internet connection is available and after a reconnect the database has to be synchronized over a REST Service. This is - of course - included in my FDK (Client and Server). Most of my projects are using this implementation as a start and doing some improvements on top of it. That is fine for Project A, but it would be nice if Project B could also get the benefit of improvements in Project A? But how to code special and also universal for more than one project? Maybe this is possible, but not if you have to keep everything in mind. And here comes project H into play.

I need a perfect representation of all project states and progresses to get an overview at which point I need to developer feature A because Project A, D, F are at a point where no progress could be made without this feature. Because all three projects a evolved as far as possible to the point where this feature has to be implemented, it must be easy to find similarities and every project could use the same improved implementation and only have to do some minor project specifications.   

hmm... if this is not the case I spend hours and hours in developing project H (my version of agile software developing tool, if you did not read part I) without any benefit.

At the moment I have not made a decision. Perhaps you have also some ideas - I would love to read your comments. But don't try to convince me for a web service... ;-)

I've made some POC's how to drag and drop "Features" from a backlog into a sprint, show sprints and points, but I've not tried to draw any Gantt, waterfall or whatever the name is of my final graph...

Of course, if I start project H, it will be FMX to be able to do everything on the road over a mobile device. Did anybody else need this kind of "simple" software? Should I do my first open-source project or try to sell this software? Perhaps it depends on how many developers what's to help me with this project. So again please leave a comment or give me a call...

btw. Happy x-mas





Friday, December 13, 2019

New Style-Designer Software

Hello!

Perhaps you read my post on FB already - if not - I'm planing together with MVP Steffen Nyeland, to develop a new "Bitmap"-Style-Designer for FMX and perhaps also for VCL or to make it work closer together, to create a style that is working on FMX and VCL. (If this is possible - never tried to create a VCL style so far) 

Perhaps you followed my posts about my tests with the current designer.


One problem with designing a new designer is - of course - the result has to work with the RTL. It would be possible to create a new StyleBook component, but the main styling should work with the given RTL. The main focus is to get the software with much better usability.  

If you are interested to work with us please give Steffen or me a call. Perhaps you have a good idea of how the designer should work, but do not have the time to help with the development, we would like to read your ideas. If you are working with the BitmapStyleDesigner and just want some improvements - we would also like to read that, too

Should we design our new designer mostly like the "original" or should we go in a completely different way? 

Without wanting to influence your ideas, this is our ideas so far:

  • new UI
  • FMX-UI for "all" platforms
  • custom style colors
  • live preview 
  • hook for own preview window
  • better documentation! (Where setting A is used in component B)
  • external icon management (load icons and compose "the" bitmap)
  • no more draw a rectangle around every image.
  • use SVG to create different resolutions

There is more, but many parts are still under consideration - we also have not decided if we do this as open-source or not...




Thursday, December 12, 2019

Android 64 Bit device list.

Finally, we have the compiler to do the Android-64 deployment. But do we have 64-Bit devices?

The problem is, even if the CPU is 64-Bit maybe the installed OS is only 32-Bit. Of course, this is only a problem if you care about it. 

If you are using the non-native stuff - the CPU doesn't care and also if it is 32 or 64 bit.

But I like to debug my stuff, so I need a 64-Bit device and I really dislike spending a lot of money on the kind of device, because my daily drive is an iPhone.

Spending more the 300€ for a device just for some debugging is crazy.

If you google for a 64-Bit Android you do not find anything, because nobody cares about this.

It is also very hard to get the information on what CPU and what version of the OS are running. You have to install AIDA64 or some other test-apps.

So if you have the proof that your device is 64-Bit and also has a 64-bit OS installed and costs less then 250€ please leave a comment.

Saturday, December 7, 2019

Lost in Units...

If you start a new project or perhaps the POC of your new project, you normally save the main form and the project file to a sub-directory of your choice.

And then?

How do you name your units or your forms? Do you put your units in sub-directories? Do you have naming conventions?

In the past, I used a "w" in front of my unit name if it was a form. (Winform)  And of course, the Filename had only 8 chars because pre-Windows 95 filenames had this limit...

I hate projects where every unit has it's own sub-directory...

So how can we do it the right way?

With MVVM or I think any other pattern to separate the Forms from the Business-Code you get more units as without or the "Thing" we call RAD.

Comparing RAD with MVVM we get 2 more units (ViewModel, Model) perhaps beyond the Model we get 2 different implementations of a DTO Class. Perhaps one more Unit for a separated Interface-Unit. So in the worst case, we get 6 units per "View/Form". If it is a From that contains more than one view it gets "worse".

I like to have "View/Form" related units together not all Forms in one sub-dir and the modal or the ViewModel at a different place.

If you have a project with 200 forms, with MVVM we get something between 600 and 1200 units. This is a mess if you have no strategy for your unit names or where to put the files.

So where is your limit putting every file in the same directory? For me it's the height of the project tree in the Project-Window. A little bit of scrolling in the tree is fine but if this tree is too big I get lost. So some time in a growing project I have to put files into sub-directories. I hate to do this, because if I need a reference to these units, every unit has to be included in the DPR file or I have to include every sub-directory into my search path.

Let's start with naming.

Since I'm using MVVM I use the "MVVM-Naming" in every project, so

MainForm -> Main.View.pas
Global interfaces -> MyInterfaces.pas
Global settings -> config.pas
Global ifdef -> IFDEF.pas
Application startup -> bootstrap.pas
Application construction -> Composition.Root.pas

Forms are named "XXXX.View.Pas"
ViewModels of course "XXXX.ViewModel.pas"
Models of course "XXXX.Model.pas"

"Just Units" - that are not service-related are placed in a sub-Directory ("no platform") only if they are not related to a special platform.

Platform related Units I have sub-directories like ("Windows","iOS","Android","OSX","Linux");

So my "normal" Dir-Tree is looking like this:


- Artwork of course for all Icons and Bitmaps especially for FMX!
- BIN as Target to resources
- POC for Proof on concepts
- XE10.* for RTL Source file copies (I always have to change some files/parts)
- Tests for all Unittests.
- tools for all these small tools you need to build this project.

For a smaller list of matching units with the namespaces I had - or we had - an idea at our last Delphi-breakfast today.


So please support my feature request :

Thanx!

Friday, December 6, 2019

MVP of the Year / German candidates.

Hi!

The election of the Embarcadero MVP of the year has started.

If you like my stuff please vote for me!

Here is the link to Olaf Monien's homepage (Developer Experts) if you like to vote:


This is only for German MVP's every region has it's own system.

Thursday, November 21, 2019

Delphi 10.3.3 and Android 64

Finally here are the news about Delphi 10.3.3.


No more mimimi about not be able to build Android 64 with Delphi.

Also iOS 13 with Dark-Mode support.

If you want to get the information what mode the User has selected, just modify the FMX.Platform.iOS (Copy file to your project directory)

and Copy

const
  UIUserInterfaceStyleUnsepcified = 0;
  UIUserInterfaceStyleLight = 1;
  UIUserInterfaceStyleDark = 2;

and 

function GetUserInterfaceStyle: UIUserInterfaceStyle;

to the Interface section!

Also a ready to use Linux-Docker image on Docker-Hub.

If you have the Enterprise Version and want to Build your App with FMXLinux you can provide empty implementations for some System units.
Of course only necessary if you are using this stuff in your app.

// Empty Implementations
System.Linux.Notification.pas 
System.Linux.Sensors.pas
// Add IFDEF Linux64
System.Notification.pas
System.Sensors.Components.pas
System.Sensors.pas


Tuesday, November 12, 2019

#CodeRage2019 - Fluent Creation of controls at runtime!

The Embarcadero CodeRage2019 (worldwide)!



Of course, I had to provide a session to this event with one of my beloved topics:

My FluentCreator!

(Part of my FDK - The Firemonkey Development Kit)

The #CodeRage2019 event should only contain tutorials of 5 to 10 minutes of playtime. So I will provide a more detailed session in the next days on my YouTube-Channel 



(Btw. This is my first tutorial in the English language - I will provide German subtitles on my channel in the next days and if I find the time I will upload my older sessions with English subtitles as well)

Yes, this channel has not seen any new content for a long time, but I will provide more stuff in 2020.

The short version you can find here

If you want to submit a question to the Firemonkey Multi-Device Design Q&A session at 14.Nov.2019, please click here.

Here is the full list for the FMX-week

Please leave a comment or send me an email if you like to see another topic of Firemonkey development.

Thursday, October 31, 2019

How long does it take to develop a "complete" MVVM framework for Delphi?

This is a really good question. (Btw. what is complete? We all know a framework is never complete)

Maybe you have a different question in mind... Is it worth to spend x man-days trying to develop it? 

Spoiler - Yes!

If I had not believed that it was possible, I would never have started another attempt. 

If you have not read my other posts about MVVM - yes I've been trying this since 2015. (Of course not all the time).

Is this my last attempt? - I hope so - or better, I hope that this is the final version that fulfills all my wishes - as well as yours  (one of which is to prove: Yes, with Delphi it is possible to develop a framework with the idea behind MVVM)  

Most of the time I had to spend on a better binding structure, studying the source of this unit... Oh boy, I have to refactor this code for better readability.

We all know the MVVM images with the three colored boxes and the fancy arrows labeled with reading, writing, binding, property changes, event or whatever. Everybody starts with this.

Then you google for tutorials or search at youtube. Yes, you will find some stuff, but if you dig deeper and deeper into MVVM you have to rethink about these videos. So many mistakes. (of course from my point of view).

On the surface, the MVVM-Pattern is just a guide on how to separate the visual parts from logic and put everything in a state to be able to perform unit tests. Is this so? 

Yes, but the devil is in the detail.

And everybody is doing it a little bit differently. Then you learn from this tutorials how to do "a" and by reading more and more "a" is suddenly an antipattern and everybody is blogging about "a" is bad you have to do it like "b". Sometimes it sounds like the discussions about using FreeAndNIL. (Please no comments on this topic) ;-)

Who holds the instance of a, who can create b and how to perform c? Using the approach from a tutorial or is there a better way? - is the better way still the "right" way? - and who decides this? Some experts or MS? What is an expert in MVVM? 

If you are in front of your screen staring at an empty unit in the IDE - I call this 

"The loneliness of development" 

you easily get overwhelmed from all the decisions you have to make. #AloneInTheDark Only if you are using the dark style!

My advice - talk to another developer. Perhaps she/he is not right or has a completely different idea or opinion - that does not matter. Take the feedback and do it your way, perhaps you can adjust your first idea with the feedback.  

And here I am - 3 months into the final version. (only in my spare time I do the MVVM development). It's working - and it is fast - and it is easy to use - and there is (nearly) no code in the View/Form - and most of the necessary (stock) visual controls are already working (no imposer necessary) - and you have to write less code you would expect - and I love the implementation. 

More than half the time is debugging time (so far). I did not use TDD this time, because I had no idea where to start with the tests. 

Good news:
- The implementation is working with FMX ( this was no question, wasn't it ) but also with VCL.
- I have a small team of developers for beta-testing.
- There will be two different versions. Of course as a Plugin to my FDK, but also a stand-alone Version.

The FMX Version is more advanced at this state and the VCL version will see "the light of release" a little bit later. The documentation is not existing at the moment and to show the benefits of the framework I have to do some youtube-videos - this is for sure. But not this year - perhaps you will see "something" at CodeRage 2019. (Nov 11. 2019). But this is not decided today.

To answer the question of the blogpost: 6 Month or 4 to get a beta and perhaps one more month for documentation and another one for videos. I will use the FDK installer, which is capable of doing user registration, updates, online-store, and invoices. (bug tracker is coming) Two months. So overall until everything is out including VCL - The final answer is one year.

I assume, that with the final framework, I will be able to create MVVM based Apps at least in half the time than before, just a little bit more than doing good old RAD-stuff, but everything testable. By combining this framework with my FDK you can build a multi-platform-app in weeks instead of a month. 

The future of App-development will be great.

PS.: The new version of the installer is using gnostice document studio for FMX. At forentage I told everybody that I not using this component by myself - this has changed. Thanx to my friend Girish Patil for the support.


Tuesday, October 15, 2019

FDK Version 2.0 Beta online!

Hello FDK fans!


Finally the new Version 2.0 is online. As always, you are able to order and download it with the setup application.

As we haven't done any updates is the last year, there will be a special offer:

If you're already an FDK-customer you can order an update of you Version 1.0 only for 29,95€. If you like to update to Version 2.0 (beta) there is a discount until 15.12.2019, so you get the update for only 199,- €. The normal price is 299,- € for the update.

If you are new to my FDK the prize for a new customer is 399,- €. If you like to order the FDK with an online lesson, just send me an EMail.


Greetings

Monday, October 7, 2019

MVVM for legacy Apps?

The most developer would not do this step. But what kind of refactoring you want to do?


Well, if your app is still pre-Unicode, you probably have more to think about than implementing an MVVM Pattern, isn't it? Let me take a look into my crystal ball:

One problem of your migration is: If you change one thing at one end, you break something at the other end. I assume you have no or only a few unit-tests. Your app is not testable, because all of your business logic's are in your forms and everything is using nearly every other unit? You have referenced all over the place and have not used one interface?

Welcome to the club.

Perhaps it is even worse and you're using (typed) Short-Strings as Var-Parameters everywhere?

So your migration is not a "one-shot changes everything for good". It's more like change a little bit here and there and hope for the best. I hate to say it, but I'm doing the same for many years. Starting with old components!

I have the source, but it is really to complicate to migrate every old stuff. (And why it is working) so the best way is to do an interface wrapper and if everything is still working, I can put this in a DLL compiled with the old Delphi and uses this DLL from Rio. Perhaps some time replace this with a new implementation.

So far so good. One problem is still in place, I'm not sure if really everything is still working, because I can only do some "human application tests". Wouldn't it be great if I had at least 10% unit-tests coverage of the main core stuff? How to accomplish that?

Here is the deal: Convert your app step by step to MVVM. Normally it's not so complicated, because in 99,9% every Form is one View, every Frame is one View and normally you would end up only with a 1:1 relation. Do you need a Model? In a best-case scenario, yes!

A part of my #DMVVM framework would be related to doing this kind of "easy" migration. But there are still some problems: No real RTTI and generics in D2007. If the framework can be compiled with D2007 - possible not, but perhaps the D2007 stuff could be in a DLL.

Stay tuned...

Tuesday, October 1, 2019

FMX-Styles Update

Prior posts about FMX Styles!

Here a little update:

I changed all the SysColors to $FF000001 and all Colors to $FF000100 then exported a list to see if these color values are used elsewhere. And yes they are...
Not the colors from the Colors tree, but from the SysColors-Tree. So I change all "not found" colors to 000101,000102,000103,000104... and so on.

Then I compared the to exports:



So here is an update of the used SysColors:


EditStyle Selection-BrushColor and other selections using the clHighlight Color and for Focus. Like in Grids.


Funny the Grid-Lines are using clBtnFace.

The ListView is perhaps (not in the Styleviewer) using the clWindow Color for Background and ItemBackground (not confirmed). And the TEllipse is using clBtnText for Fill-Color - strange - also not confirmed.

That's it.

Monday, September 30, 2019

Did you try to design an FMX-Style?

Do you like the styles that are included or downloadable from getit?

Perhaps you have tried to design your own style with the Bitmap-Style-Designer. 

Did it work for you?

Perhaps the problem is, that the Style-Designer is more on the VCL side... Let's take a look. First create a new "Modern Windows Style". There are two color entries (Colors and SysColors) Let's set all Colors to green (Except three that are really needed) and all SysColors to Cyan except the only two that are used from here. Then it looks like this:


If you change a color like "Window" (I did orange) the color value is not indexed to all components, the color is copied to the components. Like:



Perhaps it's a feature to be able to change this color...

Hmm, and where did I already set the font- /back-colors to white/black? 



OK, some colors are not set over color values, because the color is rendered from the bitmap.

Take a look at the edits.


Wow the Edit background is lighter, but how to set background color? It's set by this bitmap. The background of this image-part has just a  not 100% transparent Alphacolor. 



The Run-Test-Button is helpful, because you can change something and check the results... Like this:

That is colorful - but where are all their colors from? Not from the color settings - too bad! These colors are set under Listbox (but not all).

Listbox Header - two different colors - but not set with the header:


If you think this is perhaps set with PlainHeader, no PlainHeader is the Teal-Group Header and of course always the Font-Color not the Color entry. It would be to easy just set PlainHeader.Text.Color := clBlack. and this property will also set the Fontcolor. The blue GroupHeader is set by GroupHeader.Text.Font.Color and BottomDetail.Text is also set with BottomDetail.Text- that's fine. DetailText is correct. PlainItem is not PlainItem. DetailText2 is not Detail it is the ItemText5 and Detail from this is set with BasicText2. Get confused?
Scroll down there is a single entry for ListBoxHeaderLabel - this is the other ListBoxHeader. The other (Black ListBoxHeader) is not set under Listbox, because this is a ToolLabel and set under ToolLabel. This is the same for the ListItemButton.Text.


And this colors?
Purple backgrounds are set with - roll drum - clBtnFace under Syscolors. This is also the color for the Splitter.


The yellow border is set under Colors - Border.
But where to set the Arc and the CornerButton? This is not set by the Bitmap...


Here comes the best part. The CornerButton is set with a gradient and the gradient has two colors.
And no - the color is not set over Color and of course not set over Font.Color the Color value hast Du be set over PARAMS! But don't forget to switch From ARGB to ABGR (Blue and Red color switch places)

This is not a complete list of problems with the colors and I did not test this colors with a real world app so far. I did not test this on all platforms. I will try to implement some kind of color - converter - post-setup for the styles... 

So stay tuned.

PS.: Here is a litte update!

Wednesday, September 18, 2019

MVVM PropertyChanged is not Component related!

What? I use many components!

ok - let's assume you have a Button on the Form and the button is labeled "Save". How do you want to handle this button? 

1.) You can use this button like a web designer and after the button is pressed you can show up some hints: "Password missing", "Email missing" or whatever. So the user can press <Save> and directly see what is missing.
2.) You can disable then Button and enable it if every field is filled as you expect.  This is kind of a guessing game or you must have some remarks like "*" for fields that have to be filled. The drawback is, sometimes you have to search the view for the little missing "I agree" checkbox.

In a few situations, I like (1), but in most cases, I use (2).

So how to handle this in the ViewModel?  PropertyChange('DisableButton')?

No, this is wrong.

You have a property at the ViewModel like:
Property CanSave : boolean read fCanSave write SetCanSave;
In the setter you can fire PropertyChange('CanSave') and every component that has to change something could be informed by this event. When a component got his PropertyChanged call it can ask the ViewModel.

SaveBTN.Enabled := fViewModel.CanSave;

ok. 

This is the same stupid thing, already mentioned in my last post. I know "you" can bind a button to an ICommand, but that is not my idea. My PropertyChange would also include the boolean so the component or better the binder can set the value directly. Of course any boolean field could be bound directly, but what if I must do a little bit more? 

One of many ways to handle this is a simple procedure:

Binding.Bind('CanSave',Procedure(aEvent:TPropertyChangedEvent )
  begin
    if aEvent.ParamCount = 1 then
      begin
        if aEvent.Args[0].AsBoolean
          then StateImage.Bitmap.Assign(YesIMG)
          else StateImage.Bitmap.Assign(NoIMG);
      end; 
  end);

I use this approach for everything that is not working out of the box. (Implementation is currently still under consideration in some parts)

And this is the main thing. The ViewModel knows the Model (in most cases) and the View knows the ViewModel. But the Model does not know the ViewModel and the ViewModel does not know then View. Perhaps the designer of the View is a different developer than the ViewModel.

Perhaps the Model has already two new fields and the ViewModel has only implemented one of these fields, but the View isn't changed at all. Everything should work fine because there is not 1:1 relation. What should the binder do? In debug-mode it would be nice if the binder throws an exception "Property not found" and in release mode? It depends on the settings. I like the idea that every Visual Component is set to Visible := false; if the necessary property is still missing in the ViewModel, but this is up to you. How do you handle incompatibilities between the View and the ViewModel? Feel free to leave a comment!

Now, how about the Unittests?

The Model is simple, just write your tests. Test for the View? Perhaps. But besides your most important Model-Tests you also want to test your ViewModel. 

Testing your ViewModel without a View must be possible, so your Test class slips into the role of the View. By subscribing to the 'CanSave' property change - for example - and filling all the fields (or not for the negative test), the test class can check if everything works as expected.

How can you test complicated behavior like the user interaction with a Grid?

Well, this may be the topic of one of my next blog posts about my #DMVVM framework.

So stay tuned.


Sunday, September 15, 2019

MVVM and mobil app development.

A big part of the MVVM Pattern is separation and binding. I don't know how you are developing your mobile apps, but in my apps, many parts, I mean more than 80%, are created "on the fly" at runtime. Sometimes the elements would be created from the content of a database, sometimes from a REST(full) Webservice and sometimes from a config or user settings.

So here comes the funny part: Imagine controls have to be created from a database. From a ButtonClick on the View, the ViewModel calls the Model. The Model loads all the necessary information and hast to provide this information to the ViewModel. So far so good.

If you take a closer look, every component -  like a TEdit - is some kind of View. Views are created by the composition-root, perhaps from an event of the navigation-service, perhaps from a ViewLocator or in case of e.g. Messagedialogs, from a dialog-service. 

In this case, the ViewModel is created with a component-service to create a component from a predefined collection. Wouldn't it be great, If we already had a service like this? Yes we have. My FluentCreator could be called by this service and is able to provide an easy way to create predefined  - even complex - view-structures like I've demonstrated in my scale-able calendar component. 

But where is the target? The target is a container (TLayout/ListBox) on the View, but we don't have a View-reference in our ViewModel. Conclusion the View must call the component-creation-service. Not a big deal, we could create the View with this service. But how to pass all the information from the Model to the ViewModel to the View to the component-service and keep in mind, the Viewmodul has to be testable and if possible the service, too.

One problem, the possibilities of component creation are endless. We could fire a PropertyChange with some kind of string. E.g. "Create Edit_ID parent Listbox1" we could find the Listbox1 and we could create a TEdit_ID from our lookup list in our component-service. But our ViewModel should not know "Listbox1".

The next problem is the binding. How could we create the binding to our ViewModel? There aren't any properties to bind to. We also have to create a dynamic receiver for the created components and I'm sure we have to provide some kind of database connection to the receiver.

It looks like our component-service as three parts: One for the View, one for the ViewModel and one for the Model... 

To implement an easy to use MVVM framework is not trivial, but doing everything at runtime is a step forward. Of course, there will be a way, but finding the "best" way is the tricky part.

Think about it, I would love to read your ideas on this topic.

PS.: The dynamic creation stuff is probably not mobile related, but from my point of view Desktop apps are more static these days...


Friday, September 13, 2019

VCL and FMX Styles and the Styledesigner...

I never used VCL-Styles before, because my last app for VCL is still on D2007 and we have written our own styling. 

Since XE 2, I use FMX only.

For FMX - of course - I had to use styling and the Bitmap-Style designer. I'm not so happy with this app. There is a QC Entry from 2018, RSP-22407, please support.

If you tried the Styledesigner there are many objects - that's fine - and PNG's for a different resolution. From my point of view, one big image is only helpful if you are using some kind of template for a well know graphic program. By comparing different styles you find out, that nearly every style has its own layout. Horrible. Unfortunately, there is no guide in which part of the graphic is used for which object/action. Also the Style/New creates different layouts. 

Ok, let's take it easy: Use a predefined style, save the png file, convert the colors, reload the png file, done... Isn't it? No... You have to adjust the font-colors because these colors are set individually. Wouldn't it be nice if the colors are taken from the png?
There is a "choose color under mouse" tool, but you can not open the png file and at the same time choose a color. The trick is to open on object, select background and open the rectangle editor. These windows could stay open while choosing the color.

How to uses these colors at runtime? There is no Color table in the style and if you change one color, the values are set to all objects. If you want to match a TRectangle to the given style the have to choose a control and get the color from there. So if your color settings are different from the SysColors, it's difficult. I like to have more than the given SysColors like clHelpTextColor, clWarnColor, clInfoColor. 

So how to select a color in the ObjectInspector? You can select "Red" or "clRed" but not "clMenu" or "clScrollBar". 

The Styles that are downloadable or included are - from my point of view - all too monochrome. Most dark styles are too dark (lol... perhaps, because I do not like dark-styles at all) and all of the colored- styles have only one dominant color. I like my UI uniform, but not so uniform. Colors help you to guide the user's attention. If you place some controls on a Panel / Rectangle with a different color you can show the user that these inputs are important or less important. Perhaps UserColor1, UserColor2..UserColorN would be nice.

How to get a button with an icon? You can use a button with an Icon or you can create a new entry in the object list, add an image to the "Big-Picture", select all rectangles for enabled, disabled, hot, focused. Copying a button is a piece of cake, but how to add the image? There is no build-in function. You have to take a graphic-editor to expand your png's (1x,1.5x,2x,3x) keep in mind to place your 5 images on the same spot, if not, you have to select all rectangle individually. But how? Solution: Write a tool to add Images. After your tool has created all png's you can import these images and select the rectangles. But where are the right corners? There is no grid  and if your icon has no outside Rectangle. you never find the right points (up/left,bottom/right). Wouldn't it be great if your tool could provide a config to do this selection on import of the png? And why is there no function to do this inside the Style designer? And why is there a big image depending on how to create and find all the right places? 

Wouldn't it be cool if you can provide single images for all functions/objects and on style-save, these images got composed (with no, or less spaces) into one big png? (for each resolution)! No Rectangle selection no guessing game where to find what? Perhaps single images are not so easy to create if you are a style-artist, but in this case, the Bitmap-Styledesigner should be able to export a uniform png with rectangles where to place your images. This image could be re-imported and could be striped into single images for later composing.

If you want to change the Font-Color for e.g. TabTextActiveNormal, you can open is (Font Dialog, no selection of pre-select colors) or you can change the color, but the actual color is not set in the color-dialog. So to change the color to a darker color you have to guess or you have to put in the colors for RGB. (Not with the clipboard.)

Many stuff to do... Like in RSP-22407 - I really have no time to write my own Styledesigner starting by New-FMX-Project.

Please leave a comment of your idea or if I'm totally wrong. ;-)



Wednesday, September 11, 2019

FDK - Unit-List is online!

I finally found some time put some kind of Information about my FDK on my website.

Full documentation is coming, but for a start you can have a look at the Unitlist.




Tuesday, September 10, 2019

MVVM Survey results and feedback!

First of all, thanks to everyone who participated in my MVVM survey. Your feedback will influence my decisions!

Here are the Results:

693 Views resulting in 159 completed surveys. (22.9%)


I created 4 different links (my Blog, DelphiPraxis (german only), Twitter and Facebook. The main difference is the View/Fill out ratio.

Facebook : 32,4% // Best of 4 - Thanx
DelphiPraxis : 30,6% // not bad! Danke an meine Leser!
Twitter: 16,5% // I still have no clue why anybody is writing here
This blog: 14,6% // Hey my friend's - you are already reading here!

Perhaps I have to add DelphiPraxis and my blog because some got the RSS-Feed link!


Do you already separate your logic and your UI  with (MVP, MVC or MVVM)

58 from 159 would like to separate logic and UI.
66 already using some kind of separation. // more than I expected

Interfaces?

14 from 159 answered: Don't want to learn how to... // Strange
104 had no problems with interfaces.
41 want to learn how to work with interfaces. // Should I do a Youtube Video for this topic? 

Please leave a comment!

Attributes?

48 of 155 never used
78 of 155 knows how to use
57 of 155 already implemented own Attributes // Good
12 of 155 dislike Attributes in the source code // Ohh... Please give it a try  

Generics?

19 of 159 never used
8 of 159 dislikes generics

If I would use an MVVM-Framework it has to

- match the C# tutorials (12,6%)   // Sorry this won't happen
- work save and fast! (42 %) // Thanx you are my target group
- be freeware (38%) // Sorry this will not be free
- work with VCL (73,3%) // OK, I will implement this too *grumpf*
- work with FMX (50%) // Main target - of course it will work with FMX
- on all platforms (50,6 %) // Of course... With and without ARC I hope for 10.4

If the MVVM framework is not free/opensource what is the chance you would spend money to buy it?



How much would you spend for a Delphi-MVVM-Framework


less than 100€ (58,8%) // For so much work it's a little to low (perhaps as early Bird)
100€-199€ (24%) // Maybe
200€-299€ (8,5%) // It's a good prize
300€-399€ (2,1%) // Good news it would be less
more than 400€ (6,3%) // Thanx, but I think for this price it's unsaleable

Remember it would be with free updates for one year.

How old are you?


How long have you been developing with Pascal/Delphi?


Mark all your Delphi Versions you are still using.


29% are using a Delphi-Version older than Delphi 2007 // Wow why?
14,7% still using 2007 // Welcome in the non Unicode migration club
31,8% Delphi 2009-XE9 // Please update at least to Seattle
12,1% Seattle // OK
24,2% Berlin // Better
41,4% Tokyo // Very good!
70% Rio // NICE!


So far so good, thanx again and leave a comment or give me a call if you want more information!

Saturday, September 7, 2019

Is there a sharp border between MVVM and MVC/MVP?

This is a really good question... And without long thinking about it, you probably would say "yes"!

Ok! But where do you draw this line? And why?

Many MVVM Experts - whatever makes them experts - would tell you: Delphi is unable to do "real" MVVM because we have not the binding stuff like C#. 

And no! We don't compare the live binding with C#'s binding.

So why I'm still on this project since 2015, to prove the experts wrong? No...

The reason why I'm still developing an MVVM-Framework is that I'm looking for the best way - with Delphi - to separate the form from the business logic and the database. 

Perhaps, in the end, we will have some kind of patter that should not be named MVVM, but I don't care if it works as expected. Comparisons with C# should be stopped here immediately. We do not edit XML files by hand and we like to avoid so much typing for every propertychange. :-)

Transferring data from an Edit to a property in the ViewModel, to the Model, to the database is a piece of cake. But even at this point, I do not want to fire an event like "Hey my Name has changed guess what the new value is, or ask me". So I like to broadcast my Name to all listeners!

But when it comes to ListViews or Grids, things getting difficult. What event should I fire or what if the Grid is scrolled, should I preload more rows? Is this part of the binding or the ViewModel or a Cache-Class? Where to store the data?

But back to the topic!

MVVM did not have access to a component, MVVM is only dealing with properties. MVC/MVP has more direct access. So what can we do to get "kind of" access but not the component itself? If I cross this line, will every expert tear me up in the air? So I do not do this.

Of course, you can do some kind of imposer grid that is able to handle a properychanged event and then? Get the complete data to compare or just refresh all data in the grid? Because one "cell" has changed? No sorry, not on my shift.  

The View has - perhaps - some stuff to do with the grid. But not holding the data! That's why I like the FMX, TGrid implementation where you have to provide the Data to the Grid only for the cells that are currently displayed. But how can you connect the Grid to the ViewModel, I mean how could the ViewModel throw some events to do so?
Your GridViewModel could have a property Cell[Row,Cell : Integer] : TValue; But I dislike to have a ViewModel for every Grid! 

Imagine this kind of application:

One Form as Person.View fĂĽr editing all the Person-Data fields. But at the bottom a nice grid with matching addresses. If you click on the Grid the data is loaded into Edits.

So wouldn't it be nice to have some access/datastore in your Person ViewModel for the grid also?

I think so...  I call it GridProperty and in this case I call it:
fMatchingAddresses : TGridProperty;

On the View I have a normal TGrid, but how to connect to the
Property MatchingAddresses : TGridProperty;?
Just place a TGridAdapter from the MVVM tab on your form and connect your Grid to the GridAdapter. DONE. Everything else is done behind the scenes. You can configure the GridAdapter like the were a database involved, to select the Fields you want from the all-possible-field-list.

I call this a #PropertyChangedTunnel. Is this already not MVVM anymore? Whatever! Then find a better name for my pattern and I will consider changing the framework name... ( Perhaps not )

And there will be some kind of ORM interface stuff to fill the property with the necessary data from the model and/or give a callback to read more data from the Model/Database. 

Does it work?

#FastAsHell

Stay tuned... More info's are in the pipeline.

Wednesday, August 28, 2019

Thursday, August 15, 2019

Missing stats in 10.3.2?

Project statistics are "gone" in 10.3.2!

I love this little time in my projects and I could not understand why other developer is complaining about this feature. Now it is gone...

No, it's optional but you have to create a registry key:

In HKEY_CURRENT_USER\Software\Embarcadero\BDS\20.0\ProjectStatistics, 
create a DWORD value “Enabled”, and set it to 1.

if "ProjectStatistics" is missing just create this key, too

Happy Time-Counting...

Sunday, August 11, 2019

FMXLinux first test.

FMXLinux first test.

I did not test the Linux part of the RAD-Studio ecosystem, because every Server-Stuff is running on my Windows Servers. So I never had the need to play with Linux at all.

And I also never thought about Linux as a Desktop System. I have no customers that want to use Linux and also I never tried anything with or on Linux. 

Perhaps that's why I hate OSX and would never use an Apple for development.

But:

Installing Ubuntu in a VM as not a big deal and with some Sudo Stuff it was easy to install the necessary parts and the Paserver.

So a "Hello World" App is running in seconds with no problems.

For the real-test I want some more, so I tried to compile my Store App ~380k LOC with many kinds of FMX stuff in use.

And here I found some problems. Not all the System units have the necessary IFDEF's for LINUX/LINUX64.

So I had to copy System.Notifications, System.Sensors.Components and System.Sensors to my Application directory and provide empty implementations for System.Linux.Notification and System.Linux.Sensors.

Indy is throwing an exception because of the Thread.Nameing-Stuff has also no Linux part. (But this is only in Debug-Mode).

With these little changes my app got compiled and runs on Ubuntu.

Some UI parts like fonts (font size) and Images are not working as expected. I did not track down the Image-Button problem so far. But it looks that everything else is working.

Nice...

Compile and Deploy time is perfect compared to OSX, because both VM's are running at my development PC (5 GHz, Raid 0, M.2).

Because I have no use-case at the moment, I have nothing to test on Linux at the moment...

(Oh wrong! I'm currently developing a Backup-Cloud-store-Cryping Server on the Raspberry Pi, of cause on Android - too bad my only use-case at the moment would be Linux 32 bit on ARM CPU and this isn't supported with Delphi)

Have fun...





Tuesday, July 23, 2019

Consulting fĂĽr VCL & FMX Projekte!

Hallo!

NatĂĽrlich biete ich weiterhin Consulting und andere Hilfen bei euren Delphi Projekten an.

Die aktuelle Preisliste ist weiterhin online verfĂĽgbar unter:

http://www.delphiprofi.de/delphiprofi-preisliste.pdf

Bei Interesse einfach eine mail an Frank(at)delphiprofi.de

GrĂĽsse

Saturday, July 6, 2019

Time shared development.

Good or Bad Idea to shared your development time between projects?


For some time I had no topic to share with you, I'm sorry.

Like most other developers, I have not only one project to do. Of course, there are two or three main projects to handle, but what's about the side project I have to or like to do?

In the past I stopped the development of my main projects and switched the focus to project E. After finishing E in a short time, I came back to A, B, and C. That was fine for a long time.

Sometimes if I got stocked in my development I put project E on holt, to get back to ABC. If the amount of time was too long, I started by zero if I tried to resume project E, in other words: To get back into E it takes too much time.

If I worked for many months on project B - life got boring. So what could I change?

Imagine you like to do a lot of different things - some will earn you money, some will help you with the future project and some are just for fun or you want to try some new stuff.

So with the main projects A, B and C you start 4 more or even interesting projects D-G. at this point, you have 7 active projects one for every day of the week (if you work 7/days/week). ;-)

So every day I decide what's the topic for today between A-G. Nice! Every day a new task to do. Sometimes the same for two or three days in a row, but then resume another project.

This was a nice idea and improved my work a lot.

There is - of course - a backside of the medal: Projects that normally takes 3 months now takes 12! That's the only drawback you have to deal with... It feels like you are not getting any progress because no project get's finished or even shipping state.
So do scrump with no team? Perhaps some kind of project Gantt graph thing, to see progress in all your projects… If I find good software, I like to try this.
Or add project H for that topic to my list… ;-)

Friday, February 15, 2019

Be carefull with inline vars.

The new inline var is a great feature. You can save time and your code looks more cleaner.

But are there any problems with inline vars and the auto-type functionality?

Let's take a look at a small example.

Procedure Foo
var
  i : int32;
  x : uint32;
begin
  x := 0;
  for i:=0 to x-1 do
    Bar(i); // Bar would never be called.     
end;

Procedure Foo;
var
  i : int32;
begin
  for i:=0 to MyList.Count - 1 do
    DoSomeThing(MyList[i]); // Should work as expected
end;

Procedure Foo;
begin
  for var I := 0 to MyList.Count - 1 do
    DoSimeThing(MyList[i]); // Are you sure this is working?
end;

At this point, you are unable to decide!!! You have to take a look at the function result of Count. if the result is an uint32 this is not working, because the compiler takes an uint32 for I and the for is running "forever" ( from 0 to $FFFFFFFF ).

If your implementation of this list auto-creates elements on reading access you have a problem...

Edit:
Sorry about the late comments - I did not know I have to approve them.

Tuesday, February 12, 2019

Simple 3D Hello World in Firemonkey!

Games with FMX!

Is Firemonkey ready for game development - of course! There are many games out in the wild written with Delphi and also with FMX.

Why this blogpost? Because in the last weeks there are so many questions in forums or FB about this topic.

But where to start?

Do you want to go 2D? 


Great simple answer:

1.) Use a TRectangle with a PNG for your sprite(s).
2.) Use a Timer with 16ms for your game-loop.

Go and write - like me in 2015 - funny games like this:



Perhaps sometime in the future, I will release this game, if I find the time and change the stolen ROM-Images with new creations. ;-)

Do you want 3D? 


Then you might want to use a "3D Engine". Why an engine, because you do not want to do the hard work for all platforms by hand. Or you just use FMX as your engine.

This could look like this:

  1. Create a new FMX 3D application.
  2. Put a dummy object on the form
  3. Put a camera on the form
  4. Put a light on the form
  5. Place the camera at 0,0,-20
  6. Set the light to Point
  7. Place the light at 0,0,-20
  8. Put a Timer on the form and set it to 16ms
  9. In the onTimer event call Invalidate;
  10. In the onRender event call your 3D stuff.
The Form should look like this:


type
  THello3DWorld = class(TForm3D)
    Dummy1: TDummy;
    Camera1: TCamera;
    Timer1: TTimer;
    Light1: TLight;
    procedure Timer1Timer(Sender: TObject);
    procedure Form3DCreate(Sender: TObject);
    procedure Form3DDestroy(Sender: TObject);
    procedure Form3DRender(Sender: TObject; Context: TContext3D);
  private
    { Private-Deklarationen }
    fColorMaterial : TColorMaterial;
    fModelMatrix,
    fRotate        : TMatrix3D;
    fVertexBuffer  : TVertexBuffer;
    fIndexBuffer   : TIndexBuffer;
    Procedure DoInit;
    Procedure DoRotate;
  public
    { Public-Deklarationen }
  end;

In the FormCreate you can create, like in the example - a 3D object. I use a simple Triangle, but you can, of course, create any 3D Mesh or object. You also have to create Material. You can use your own Material (shader) or use the build-in.

This looks like this:

procedure THello3DWorld.Form3DCreate(Sender: TObject);
begin
  fColorMaterial := TColorMaterial.Create;
  fModelMatrix   := TMatrix3D.Identity;

  // 3 for a Triangle 
  fVertexBuffer := TVertexBuffer.Create([TVertexFormat.Vertex],3);
  fIndexBuffer  := TIndexBuffer.Create(3,TIndexFormat.UInt16);

  DoInit;
  Timer1.Enabled := true;
end;

In the DoInit, I setup a triangle for this little demo:

procedure THello3DWorld.DoInit;
var
  lVector : TVector3D;
  lMatrix : TMatrix3D;
begin
  // Create a Rotation Matrix for a equilateral triangle
  lMatrix := TMatrix3D.CreateRotationZ(120*Pi/180);
  LVector := TVector3D.Create(3,0,0); // Size 3

  fVertexBuffer.Vertices[0] := LVector;

  LVector := LVector * LMatrix; // Rotate to next point

  fVertexBuffer.Vertices[1] := LVector;

  LVector := LVector * LMatrix; // Rotate to next point

  fVertexBuffer.Vertices[2] := LVector;

  // Draw Clockwise
  fIndexBuffer.Indices[0]   := 0;
  fIndexBuffer.Indices[1]   := 1;
  fIndexBuffer.Indices[2]   := 2;

  // Create Rotation Matrix for later use 
  fRotate := TMatrix3D.CreateRotationZ(3*Pi/180);
end;

In the on Form3DRender event you can provide all your generated objects to the renderer.

procedure THello3DWorld.Form3DRender(Sender: TObject; Context: TContext3D);
begin
  if ( Context = nil ) or not( Context.BeginScene ) then
    exit;

  try
    Context.SetContextState( TContextState.cs3DScene );
    Context.Clear( TAlphaColorRec.Black ); // or any Color

    // Set ModelMatrix
    Context.SetMatrix( fModelmatrix );

    fColorMaterial.Color := TAlphaColorRec.Yellow;

    // Render Model
    Context.DrawTriangles( fVertexBuffer, fIndexBuffer,
                                          fColorMaterial, 1 );
  finally
    Context.EndScene;
  end;
end;

That's it. Now your FMX program could render any 3D object to the scene.

For entertainment, the object should rotate or do whatever you like. That's why this demo has a DoRotate method.

procedure THello3DWorld.DoRotate;
begin
  fModelMatrix := fModelMatrix * fRotate;
end;

This is a simple Matrix3D rotation. To use this rotation just call DoRotate before you call the invalidate. Normally you would measure the time difference between two frames and do the calculation for this deltaT to get even rotation speeds on all platform / CPUs. But with our timer we are fine for this demo.




With a collection of elements and some logic you can build your own 3D Engine and create some nice 3D stuff or games.





If you like to see more 3D Stuff write me a message.