SmartClient Software Factory.

SmartClient Software Factory.

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


Indyy66 posted on Monday, October 16, 2006

Is anyone out there creating any of the software factories from MS? I want to us it with CSLA in a new application. 

 

Thanks

 

 

ward0093 replied on Monday, October 16, 2006

I just started reading about it... i have nothing for you yet!  Sorry... but i will keep you posted

Indyy66 replied on Tuesday, October 24, 2006

Thanks Ward,

I'm going to do the same. I'll start with the simple getting started project and then inject the CSLA 2.0 framework in from there.

 

James

Bayu replied on Wednesday, October 25, 2006

Hey,

'Software Factories' is a broad concept. What do you mean specifically?

If you mean using CAB (Composite UI App. Block):
- yes, I (and I believe several more people with me on this forum) have experience using it with CSLA. From my experience: they are a winning team. It must be said: to get them up and running takes some time, but if desired I could tell you more about specific details.

If you mean using GAT (Guidance Automation Toolkit):
- no, I don't have experience with it, but I have had quite a thorough look at it. I think it's nice to get new projects jump-started, but after all it's a poor man's code generator. If you want to spawn a discussion on this we could compare notes.

If something else, then waht exactly do you mean?

Bayu

burmajam replied on Wednesday, October 25, 2006

Of course we are interested in any good idea, experience and best practices with CSLA. If you would be so kind to share your CAB experience with us, we'll appretiate it.

Bayu replied on Wednesday, October 25, 2006

Sure,

Could you give me some background info on what your intent is? What is your experience with CAB? Are there any issues you already face?

Otherwise I am just shooting blind. :-)

Bayu

Indyy66 replied on Wednesday, November 01, 2006

Hi Guys,

I'm jus getting started, but the main goal is to put together a Windows client that I have written using CSLA techniques and apply as much as possible to the CAB and Smartclient factory as possible.

Q1. Can I us my existing CSLA assemblies and plug them right into a CAB application?

Q2. Whats the implications of using this with remoting?

Q3. How flexiable is the UI development functionality?

Q4. Over the Internet, are there any issuses with performance that I should be overly concerned about?

 

This is what I have sofar. Hopefully it enough to get us started.

 

Thanks,

 

James

 

Bayu replied on Wednesday, November 01, 2006

Indyy66:

Q1. Can I us my existing CSLA assemblies and plug them right into a CAB application?



Yups, not a problem. One thing to note though is CSLA's security model. Usually you get the right Identity/Principal on your thread by arranging this in some startup routine. I integrated a specific service for this purpose in just a few lines of code:

Public Class CslaAuthenticationService
        Implements IAuthenticationService

        Public Sub Authenticate() Implements Microsoft.Practices.CompositeUI.Services.IAuthenticationService.Authenticate
            <MyPrincipalClass>.Logout()
        End Sub

End Class

In your Views/SmartParts/etc. you can use your BOs just like you would in any other app. In order to allow your BOs to communicate you have several benefits that CAB offers you:
- note when the collaboration is part of your BO logic, you should implement a observer pattern like in ActiveObjects
- but when the collaboration is strictly for UI purposes, you are soon going to love CAB's state and event mechanisms

Indyy66:

Q2. Whats the implications of using this with remoting?


Nothing. CAB strictly deal with your UI. Whatever you do with your BOs and behind is entirely up to you and fully indepenent of whatever UI technology you use ....

Indyy66:

Q3. How flexiable is the UI development functionality?



Near the extreme of utmost flexibility. But you will have to pay a BIG price in getting to know it. Steap learning curve guaranteed.

Indyy66:

Q4. Over the Internet, are there any issuses with performance that I should be overly concerned about?



Don't know what you mean. If you configure your remoting channel to go through the HTTP port, then see my answer for Q2. If you mean supporting Web UI with CAB: forget it, it is exclusively for use with WinForms interfaces. If you mean deployment over the internet: the CAB assemblies are quite large, so your client's first install will take some MBs. But after that, CAB is not updated too frequently.


In my experience CAB and CSLA are a winning team. If in addition you also know how to utilize reflection and generics then you have a huge potential for highly dynamic apps. In my current app I have like 50 BOs, which I can view and modify using just 2 base views with 2 corresponding presenters. Then there are like 3 views with very specific requirements, these are the only ones that need to implemented nearly from scratch.

However, you will need to invest some time in order to get your grips. Also, CAB UIs tend to consume some time to load. This is due to the wide-spread use of reflection, generics and also the plugin architecture that takes some time to discover and load all your configured assemblies.

Bayu

Indyy66 replied on Saturday, November 11, 2006

Thanks Bayu,

 

Your the Man! This totally helps with the application that I'm planning at the moment. I really appreciate the feedback from you and others on this site.

 

James

Bayu replied on Saturday, November 11, 2006

You're welcome. ;-)

Let us know what your choice I going to be.
If it's CAB, then we may share experiences some time, I too still have a lot to learn. ;-)

Regards,
Bayu

tiago replied on Monday, December 11, 2006

Bayu:

In your Views/SmartParts/etc. you can use your BOs just like you would in any other app. In order to allow your BOs to communicate you have several benefits that CAB offers you:
- note when the collaboration is part of your BO logic, you should implement a observer pattern like in ActiveObjects
- but when the collaboration is strictly for UI purposes, you are soon going to love CAB's state and event mechanisms

When BOs need to colaborate, why can't I use the CAB's EventBroker?

Bayu replied on Wednesday, December 13, 2006

tiago:

Bayu:

In your Views/SmartParts/etc. you can use your BOs just like you would in any other app. In order to allow your BOs to communicate you have several benefits that CAB offers you:
- note when the collaboration is part of your BO logic, you should implement a observer pattern like in ActiveObjects
- but when the collaboration is strictly for UI purposes, you are soon going to love CAB's state and event mechanisms

When BOs need to colaborate, why can't I use the CAB's EventBroker?



Technically, you could.

Preferably, I'd say you'd rather not.

Why?
Because the EventBroker relies on the ObjectBuilder as the ObjectBuilder analyzes all objects that it creates and detects all 'eventing'-related attributes. Under the hood the ObjectBuilder translates these attributes into delegates that interconnect the raising and handling objects.

So, if you would want to use the EventBroker for your BOs, this would have the following ramifications:
- you commit yourselves to the ObjectBuilder and thus needs to make sure all object creation goes through this module
- you commit your BOs to the EventBroker + ObjectBuilder which are both quite heavy-weight libraries. Which is fine in the context of WinForms apps since then you only have the performance hit once (when the app starts or when additional modules are loaded) in your application lifetime. However, your BOs would not be well-suited for WebForms as then you would have the perf hit at every request. This is also the primary reason (at least I believe so) why the SCSF is strictly intended for rich clients

Therefore I would recommend to implement an observer pattern simply based on delegates (you could draw inspiration from ActiveObjects) which is high-performant and will not preclude your BOs from future use in Web apps.

Regards,
Bayu

tiago replied on Wednesday, December 13, 2006

Hi Bayu,

I thought CAB was for Web Apps as well as WinForms. Anyway I got your point about Web Apps not beeing smart at all.

But I can use EventBroker withou using ObjectBuilder. See http://forums.lhotka.net/forums/ShowThread.aspx?PostID=10154#10154 
I can publish (1.2.) and subscribe (2.2) an event programmaticaly.

I not a devoted fan of every MS piece of software. But if I have an event broker, why should I also use ActiveObjects for the same purpose?

Of course I think I should also use Rocky's Broadcasting Messages to Multiple Clients http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet06082004.asp because it solves another problem.

 

Cheers,
Tiago Freitas Leal

Bayu replied on Thursday, December 14, 2006

tiago:

Hi Bayu,

I thought CAB was for Web Apps as well as WinForms. Anyway I got your point about Web Apps not beeing smart at all.


Formally, 'smart clients' exclude web apps indeed. But it's not like a doctor's prescription or so, if it works then it does, right?

;-)

tiago:

But I can use EventBroker withou using ObjectBuilder. See http://forums.lhotka.net/forums/ShowThread.aspx?PostID=10154#10154 
I can publish (1.2.) and subscribe (2.2) an event programmaticaly.

I not a devoted fan of every MS piece of software. But if I have an event broker, why should I also use ActiveObjects for the same purpose?

Aha, I was not aware of tha, I always use the 'attributes way'.

Very well then, in that case you would NOT be committed to the ObjectBuilder and some of my comments no longer apply. I guess then that EventBroker could be used in both webforms and winforms.

tiago:

Of course I think I should also use Rocky's Broadcasting Messages to Multiple Clients http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet06082004.asp because it solves another problem.

 

Cheers,
Tiago Freitas Leal




It seems like the EventBroker would provide you with a ready-for-use observer implementation indeed. If you use the programmatic way that bypasses the ObjectBuilder, then I guess performance would be fine as well (although this remains to be seen of course, but at least my earlier objections no longer apply).

There is one thing though, that you might want to be aware of: usually there are 2 kinds of messages to be sent around

1 - from one BO to another BO, these enable BOs to collaborate and jointly solve a use case in a loosely coupled way. These messages could be seen as being part of your business logic.
2 - from BOs to the UI, these are mere 'notifications' that enable the UI to stay in sync with changes in the state of your BOs.

In some applications this distinction does no need to be made explicit. But I have had cases where we did want to do this, simply because we wanted to ensure an ordering in the messages:
- first all BOs should be notified of changes
- and only then the UI

Why? Because you may not want your UI to show things while the use case has not been fully fullfilled yet.

When using a custom observer pattern between your BOs and events to notify your UI, then this ordering is explicitly in your code. When you use the EventBroker both to send messages between BOs and to your UI, then the two might get intermixed.

Just a thought.

Regards,
Bayu

dreamkey replied on Tuesday, January 30, 2007

Bayu,

Can you elaborate on how you are itnegrating the security models? In the spirit of reuse we are starting a new project using a lot of BOs from previous projects. We use the CSLA style CanAddObject, CanEditObject, etc to determine if the user has access to various funcitonality. Is there a way that we can do this without having to modify all the BO's to use the service? The big reason is that the same BOs will later be used in a web based interface (they are spearated into a common module).

Thanks

Dreamkey

Bayu replied on Friday, February 09, 2007

dreamkey:

Bayu,

Can you elaborate on how you are itnegrating the security models? In the spirit of reuse we are starting a new project using a lot of BOs from previous projects. We use the CSLA style CanAddObject, CanEditObject, etc to determine if the user has access to various funcitonality. Is there a way that we can do this without having to modify all the BO's to use the service? The big reason is that the same BOs will later be used in a web based interface (they are spearated into a common module).

Thanks

Dreamkey



Hi,

Sorry you had to wait some time for my reply.

However, I don't think I understand your question. Security is a vague term, I guess you mean authentication and permissions, since you refer to the CanXXX methods?

Authorization has nothing to do with CAB. The only thing is that Csla's authentication and authorization framework relies on the principal/identity pair currently set on the thread. The CAB service I showed earlier in this thread is just a 'CAB-way' to get this current principal on the thread, but it does not have to be like this.

In a regular WinForms app you could precede your MainForm with a LoginForm that takes care of this and in a WebForms app the same. In case you also support unauthenticated users you will need to set a default principal, which in WinForms you could do in the Main routine before the MainForm loads and in a WebForms app you typically do this in your Global.asax.

Does this answer your question?

If not, perhaps be more specific.

Kind regards,
Bayu

Copyright (c) Marimer LLC