Notifying Changes to Windows

Notifying Changes to Windows

Old forum URL: forums.lhotka.net/forums/t/1795.aspx


oswaldo_hp posted on Sunday, November 19, 2006

Hello,

I am new to the framework and I have been playing with the Project Manager Example and I came upon the that changes from one of the open documents do not propagate to other documents.

Is there somthing built into the framework to make this happen? . If there is not what would you think would be the way to go at it?

Thanks.

guyroch replied on Sunday, November 19, 2006

You post is very vague but if you mean "Is there a way business objects can observe one another?" then you should also look as Petar Kazul's ActiveObjects implementation.  It's an add-on to Csla with very nice Observer Pattern implementation.

http://csla.kozul.info/

 

Bayu replied on Monday, November 20, 2006

Hey oswaldo,

You are right, I have observed the same thing.

If you try hard enough you can make modifications in one screen, which are not propagated to another and in the end I believe I even once managed to get exceptions thrown.

The ProjectTracker is not a full-fledged app of course, just an example that highlights key use cases.

None-the-less, in our apps we certainly don't want this phenomenon.



As guyroch remarked, Csla does not come with an Observer pattern. But Petar's ActiveObjects do. He implemented a set of subclasses that derive from the core CSLA classes and they come with a full-fledged observer pattern.

But beware!

You should think very hard, for every use case again, whether the desired information propagation is something that is 'true BO logic' or whether it's just UI-logic. In your example, I would argue it's just something that concerns your UI. So don't modify your BOs to get some UI behavior in place, rather enhance your UI with events (or perhaps use Petar's Channel/Subscriber code on the UI level).

I use CAB (Composite UI App Block) which comes with a great event-broadcasting framework (EventBroker). I have found that I could go without Observers in my BOs so far since all my communications needs turned out to be just UI-specific, and these could be dealt with using the eventbroker. I do not recommend using CAB though unless you really feel that you (like me) will eventually get return on the relatively large learning investment (steep learning curve guaranteed there ;-) ).

Kind regards,
Bayu


oswaldo_hp replied on Tuesday, November 21, 2006

Hay thanks for the answer, I have not looked in much into CAB. However, form what I´ve it's basically designed to be used with the business logi implemented as a set of web services.

This clashes with my current architecture. My current physical architecture is formed by 2 tiers. Client Side -> UI, Business Logic, Ddata Access Code and Server Side -> Database, Stored Procedures and the like. This is because thye application is to be used by a limited number of users (15 Max.).

I am thinking of using something like CSLA because the business logic is intricate (i's based on a mathematical Operations Research Model). Have you tried to use the CAB with CSLA?, What kind of architectures is CAB designed to support?. I was also wondering how long it took you to master CAB since in the last post you said something about a deep learning curve.

On the other hand, have any of you found an already done and tried approach to Event Broker (either Observer or Publisher-Subscriber) for the UI. I could try code it myself, however I would not like to reinvent the wheel.

BTW, I also experienced the exceptions you talk about and they are not very nice.

Thanks.

Bayu replied on Tuesday, November 21, 2006

CAB builds on a services oriented architecture, not web services.  Smile [:)]
It fully integrates with your UI, so there is no clash with your current architecture in that respect.

I have successfully integrated CAB and CSLA yes, it sounds so scary ... 'in-te-gra-ting' ... but actually:
- you build csla BOs as you would always do, regardless of CAB
- CAB only affects the way you organize your UI, when applied correctly you gain flexibility and reuse
- within the views (smartparts) of CAB you just use the exact same methodologies to hook up with your BOs as in regular views (e.g. using databinding and displaying error providers).

Getting something nice out of CAB took me several days, getting to grips and doing up experience with all the parts (including the eventbroker and command pattern) took me like 3 weeks. After 6 weeks or so I did a full refactory (included a huge amount of generics and reflection) so I trimmed the number of views to just a 4 (2 generic views that can display any arbitrary csla BO and 2 specific views that handle a very complex use case).

The EventBroker provided by CAB ships in a separate assembly. So you could focus on that part of the documentation (see also Szymon Kobalczyk's blog posts on CAB) and I guess you should be able to use this full-fledged sub-system independently.

You can also have a look at Petar's website, he describes the Channel/Subscriber pattern in detail.

Regards,
Bayu

oswaldo_hp replied on Tuesday, November 21, 2006

Thanks for the answers Bayu,

I already downloaded the CAB and the Smart Client Software Factory, so I'll start with that in order to see what it's all about. I'll also look Szymon's blog. Anyway, I've got a couple of weeks to research on this so I can make a final decision on the UI.

Thanks again for all the help on this Smile [:)].

Best Regards,

Oswaldo

CSLAer replied on Wednesday, November 22, 2006

Bayu:
CAB builds on a services oriented architecture, not web services.  Smile [:)]
It fully integrates with your UI, so there is no clash with your current architecture in that respect.

I have successfully integrated CAB and CSLA yes, it sounds so scary ... 'in-te-gra-ting' ... but actually:
- you build csla BOs as you would always do, regardless of CAB
- CAB only affects the way you organize your UI, when applied correctly you gain flexibility and reuse
- within the views (smartparts) of CAB you just use the exact same methodologies to hook up with your BOs as in regular views (e.g. using databinding and displaying error providers).

Getting something nice out of CAB took me several days, getting to grips and doing up experience with all the parts (including the eventbroker and command pattern) took me like 3 weeks. After 6 weeks or so I did a full refactory (included a huge amount of generics and reflection) so I trimmed the number of views to just a 4 (2 generic views that can display any arbitrary csla BO and 2 specific views that handle a very complex use case).

The EventBroker provided by CAB ships in a separate assembly. So you could focus on that part of the documentation (see also Szymon Kobalczyk's blog posts on CAB) and I guess you should be able to use this full-fledged sub-system independently.

You can also have a look at Petar's website, he describes the Channel/Subscriber pattern in detail.

Regards,
Bayu

Hi, Bayu

Can you post some sample codes for newbies like us?

Thanks

Bayu replied on Wednesday, November 22, 2006

CSLAer:
Hi, Bayu

Can you post some sample codes for newbies like us?

Thanks



If you have specific questions then I would be more than willing to help, but I have no plans for creating a demo-app like a CAB-ProjectTracker or so.

CAB itself comes with some great examples. Especially the BankTeller sample has been very helpful to me. That, together with Szymon's blog were pretty much the only resources I used.

Bayu

Copyright (c) Marimer LLC