Blog

All Blog Posts  |  Next Post  |  Previous Post

TMS Aurelius and MVVM Design: an example

Tuesday, January 24, 2017

John Kouraklis has posted a 2-part article in his blog about using TMS Aurelius and MVVM. From the article: "Model-View-ViewModel (MVVM) design pattern allows developers to write software in a way that separates applications to layers that serve the business logic, the presentation logic and the elements of the user interface."

You can follow the links below to read the article:

http://www.kouraklis.com/2017/01/tms-aurelius-and-mvvm-design-an-example/
http://www.kouraklis.com/2017/01/tms-aurelius-and-mvvm-design-an-example-part-2/

He's also published the "MVVM in Delphi" book, you can purchase it from Amazon. More info about the book here.



Wagner Landgraf




This blog post has received 9 comments.


1. Tuesday, January 24, 2017 at 5:55:21 PM

Generally speaking, I''m afraid that the MVVM way of coding doesn''t meet the "keep it simple" philosophy permitted by a Delphi "Rapid Application Developpement" : simply put components on a form and connect them to data.

Please John, forgive me but from my little point of view, i found that the purposed sample shows "how to make thing complex when you can make them easier"... The VIEW connection is awfull: you have to list in a record all the visible controls in order to enanble/disable them according to the state of data operation! A simple TDataSource connected to a TDataSet just do it fine? Why do we have to reinvent the wheel?

In the same time i think it''s important to decouple code (logic/UI) for many of the goods reasons exposed (test, logic, reusability, platform translation, sharing..).

So i will recommand, when creating a new project, to begin to write the "core logic" in a consol application. Why not create in this phase a global object/component that will gather the main objects, procedures and functions (primitives). TMS AURELIUS is good at this level!

In a second time, decide the UI platform VCL/FIREMONKEY/DLL . TMS Aurelius is (very) good at this level too with its DataSet possibility (i.e coupling data with UI elements with some DataBinding or TDBEdit and so on...)

I''ve not clearly understood associations after 3 years using TMS AURELIUS. I use TMS Data Modeler to get the right coding but don''t know precisely how it works...





SALMON Didier


2. Tuesday, January 24, 2017 at 6:04:21 PM

Hi Didier, thank you for your comments, and nice words about Aurelius. Regarding the technical discussion about MVVM, I''d suggest you post your comments in the blog post of original author, since we have just linked to it and I''m not sure if he''s following this post here.

Wagner R. Landgraf


3. Tuesday, January 24, 2017 at 6:32:50 PM

Good suggestion Wagner...

SALMON Didier


4. Tuesday, January 24, 2017 at 7:36:52 PM

Good suggestion Wagner...

SALMON Didier


5. Wednesday, January 25, 2017 at 9:27:38 PM

Thanks Didier.

I have posted a few thoughts on your comments in my website.

Kouraklis John


6. Friday, February 10, 2017 at 4:41:27 PM

Unfortunately John''s site is hacked and unavailable

Baecker Gernot


7. Wednesday, February 15, 2017 at 12:25:50 PM

Hope he manages to bring the entries back

Kinzler Markus


8. Wednesday, February 15, 2017 at 12:50:31 PM

I have now restored the post.

Thanks for reporting this.


Kouraklis John


9. Thursday, February 8, 2018 at 12:50:58 AM

Hi,
I was reluctant to move to MVVM for a long time as I too saw this as adding complexity. What was the point?
RAD is fine for rapid apps, small utilities. Rapid for more complex apps, but when it comes to maintaining them in time, then the time you saved will be lost in maintenance and evolution.
But it''s true that MVVM, once understood (it may take a while) is amazing.
Especially for cross-platform development.
I just switched the entire GUI of an app, deciding that the overall navigation wasn''t really natural.
Designed a new GUI, and connected to the ViewModels in a snap, without breaking anything. All the behaviors, the data fetching and saving was already in place.
I don''t know how I would move out of MVVM today.
It''s just like when switching to procedural to OOP programming. The benefits are so huge that getting back is unthinkable.
Take time to study MVVM. Malcolm Groves and Nick Hodges have very good articles and videos. You won''t regret it. But don''t expect to be fully operational within a week. It will take time. Time well invested.
And ViewModels and Models can be unit tested, making your code more robust and reusable. Without worrying about the GUI itself.

sjordi




Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.



All Blog Posts  |  Next Post  |  Previous Post