Comments on: Adobe DevNet publishes my blueprint for Flex apps http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/ Just another WordPress weblog Fri, 13 Aug 2010 18:04:58 -0400 http://wordpress.org/?v=2.8.5 hourly 1 By: An Excellent Article on MVC | Webapper Blog http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/comment-page-1/#comment-29337 An Excellent Article on MVC | Webapper Blog Tue, 10 Mar 2009 21:27:50 +0000 http://www.joeberkovitz.com/blog/?p=37#comment-29337 [...] Joe Berkovitz had an article published on DevNet some months ago, but I just tripped over it now. It has a stunningly good description of MVC (and MVCS) along with a succinct diagram that is the best I’ve seen for the concept. [...] [...] Joe Berkovitz had an article published on DevNet some months ago, but I just tripped over it now. It has a stunningly good description of MVC (and MVCS) along with a succinct diagram that is the best I’ve seen for the concept. [...]

]]>
By: Travis Redfield http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/comment-page-1/#comment-5943 Travis Redfield Fri, 12 Dec 2008 21:12:30 +0000 http://www.joeberkovitz.com/blog/?p=37#comment-5943 One issue I found is that following the example Components MXML (e.g., ReviewTubeComponents.mxml.template) is that controller property may be referenced by the application before it's initialized. I solved this by changing creationComplete="controller=controllerImpl" to controller={controllerImpl} One issue I found is that following the example Components MXML (e.g., ReviewTubeComponents.mxml.template) is that controller property may be referenced by the application before it’s initialized. I solved this by changing creationComplete=”controller=controllerImpl” to controller={controllerImpl}

]]>
By: Tom Lee http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/comment-page-1/#comment-90 Tom Lee Fri, 25 May 2007 00:33:35 +0000 http://www.joeberkovitz.com/blog/?p=37#comment-90 Joe, thanks - your idea about grouping like parameters together rather than having a 1-to-1 relationship between Operations and Parameters makes a great deal of sense. I think it'll be easier to understand in the long run. Thanks again for the tips, and keep writing - this blog is one of the best Flex blogs going, in my book. Joe, thanks – your idea about grouping like parameters together rather than having a 1-to-1 relationship between Operations and Parameters makes a great deal of sense. I think it’ll be easier to understand in the long run. Thanks again for the tips, and keep writing – this blog is one of the best Flex blogs going, in my book.

]]>
By: Mark http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/comment-page-1/#comment-89 Mark Thu, 24 May 2007 15:16:49 +0000 http://www.joeberkovitz.com/blog/?p=37#comment-89 Joe, thanks for the response. I hope you don't mind a follow-up. I think I am confused by the Session.as: it dispatches a "selectedVideoChange" event which does not seem to have any listeners. Meanwhile, yes, I believe the Bindings are amiss somewhere which begs another question: Any recommended techniques for debugging them? The problem I often have is that when a binding is set is different than when you expect to see results from it so it can be hard to debug any problems. Joe, thanks for the response. I hope you don’t mind a follow-up. I think I am confused by the Session.as: it dispatches a “selectedVideoChange” event which does not seem to have any listeners. Meanwhile, yes, I believe the Bindings are amiss somewhere which begs another question: Any recommended techniques for debugging them? The problem I often have is that when a binding is set is different than when you expect to see results from it so it can be hard to debug any problems.

]]>
By: joe http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/comment-page-1/#comment-88 joe Thu, 24 May 2007 14:44:23 +0000 http://www.joeberkovitz.com/blog/?p=37#comment-88 Mark -- without seeing your source code, it's hard to say why this doesn't work, but there's nothing in the architecture that would rule it out. It's probably some minor problem with how your bindings are set up. As long as VideoCommentary's 'video' property gets set to a Video, it should work since it has no idea where that object comes from. Mark — without seeing your source code, it’s hard to say why this doesn’t work, but there’s nothing in the architecture that would rule it out. It’s probably some minor problem with how your bindings are set up. As long as VideoCommentary’s ‘video’ property gets set to a Video, it should work since it has no idea where that object comes from.

]]>
By: joe http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/comment-page-1/#comment-87 joe Thu, 24 May 2007 14:37:51 +0000 http://www.joeberkovitz.com/blog/?p=37#comment-87 Tom: more on the Parameter question -- I don't think a pattern is *ever* bad merely because one came up with it oneself, providing that it's easy to understand and easy to justify and document. What I find here (now that you explained it in more detail) is that you have simply factored out some objects: strongly related sets of values that make sense to package up and send to the server as a single object. I think of these as Model objects of a sort. They are not all that different from model objects that travel in the other direction, sent from the client to the server. So there's nothing especially exotic going on here, other than the fact that you call these factored-out objects "parameters" and make them 1-to-1 with the set of operations. Such refactoring is a natural way to simplify any complex API with recurring subsets of parameters. I think if you focus on just rolling up the values that always occur together into named classes, rather than always having a single XYZParameters subclass for each XYZOperation, you'll have a more natural and intuitive Service interface. At that point, one might name than "XYZInfo" objects or something of that nature. Tom: more on the Parameter question — I don’t think a pattern is *ever* bad merely because one came up with it oneself, providing that it’s easy to understand and easy to justify and document.

What I find here (now that you explained it in more detail) is that you have simply factored out some objects: strongly related sets of values that make sense to package up and send to the server as a single object. I think of these as Model objects of a sort. They are not all that different from model objects that travel in the other direction, sent from the client to the server.

So there’s nothing especially exotic going on here, other than the fact that you call these factored-out objects “parameters” and make them 1-to-1 with the set of operations. Such refactoring is a natural way to simplify any complex API with recurring subsets of parameters. I think if you focus on just rolling up the values that always occur together into named classes, rather than always having a single XYZParameters subclass for each XYZOperation, you’ll have a more natural and intuitive Service interface. At that point, one might name than “XYZInfo” objects or something of that nature.

]]>
By: Mark http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/comment-page-1/#comment-86 Mark Thu, 24 May 2007 13:09:55 +0000 http://www.joeberkovitz.com/blog/?p=37#comment-86 Joe, I've really enjoyed working with ReviewTube and trying to get my arms around MVCS. However, I have struggled with one thing: I'm trying to break the UI into different "windows" and it's proven harder than I suspect it should be. For example, I split the MainView.mxml into two separate MXML components - one w/ VideoCommentary and one with VideoBrowser. The result is VideoCommentary does not "see" a selected video and I really cannot figure out why. Can you help?? (For reference, I am trying to put ReviewTube components into MDI windows like those used by Christophe Coenraets.) Joe, I’ve really enjoyed working with ReviewTube and trying to get my arms around MVCS. However, I have struggled with one thing: I’m trying to break the UI into different “windows” and it’s proven harder than I suspect it should be. For example, I split the MainView.mxml into two separate MXML components – one w/ VideoCommentary and one with VideoBrowser. The result is VideoCommentary does not “see” a selected video and I really cannot figure out why.

Can you help??

(For reference, I am trying to put ReviewTube components into MDI windows like those used by Christophe Coenraets.)

]]>
By: Tom Lee http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/comment-page-1/#comment-85 Tom Lee Wed, 23 May 2007 16:08:13 +0000 http://www.joeberkovitz.com/blog/?p=37#comment-85 Joe, Thanks for your response. Actually, my Parameter objects are public - I think I need to explain them a little more fully. The reason these Parameter objects came about is that the web service calls are so verbose: each requires around 10 parameters, many of which are the same (username, password, security token, etc). I found myself typing the same argument lists over and over again (in the service, service interface, and operation objects). As I said before, each Parameter object inherits from a base class. What I failed to mention before is that this base class contains the 'stock' parameters and initializes them with data from the Model. So, for example: public class OperationParams{ private var username:String = Config.instance.currentSession.currentUser.Username; // Username public function get Username():String{ return this.username; } public function set Username(v:String):void{ this.username = v; } } (I'm using getter/setters because they can be overridden by a subclass if need be.) This way, any time a Parameter object is instantiated, it is automatically prepopulated with those common values. The Parameter object is actually instantiated in the Controller, populated with the remaining (non-common) values, and passed into the Service method (which passes it into the operation it returns). This doesn't feel right because I came up with it myself, as opposed to implementing a known good interaction pattern. Is there something I'm misunderstanding in your MVCS architecture that would make the need for Parameter objects irrelevant? Or is there another interaction pattern that you feel would better serve the purpose? Thanks again for your indulgence. Joe,
Thanks for your response. Actually, my Parameter objects are public – I think I need to explain them a little more fully. The reason these Parameter objects came about is that the web service calls are so verbose: each requires around 10 parameters, many of which are the same (username, password, security token, etc). I found myself typing the same argument lists over and over again (in the service, service interface, and operation objects). As I said before, each Parameter object inherits from a base class. What I failed to mention before is that this base class contains the ’stock’ parameters and initializes them with data from the Model. So, for example:

public class OperationParams{
private var username:String = Config.instance.currentSession.currentUser.Username;

// Username
public function get Username():String{
return this.username;
}

public function set Username(v:String):void{
this.username = v;
}
}

(I’m using getter/setters because they can be overridden by a subclass if need be.) This way, any time a Parameter object is instantiated, it is automatically prepopulated with those common values. The Parameter object is actually instantiated in the Controller, populated with the remaining (non-common) values, and passed into the Service method (which passes it into the operation it returns).

This doesn’t feel right because I came up with it myself, as opposed to implementing a known good interaction pattern. Is there something I’m misunderstanding in your MVCS architecture that would make the need for Parameter objects irrelevant? Or is there another interaction pattern that you feel would better serve the purpose?

Thanks again for your indulgence.

]]>
By: joe http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/comment-page-1/#comment-84 joe Wed, 23 May 2007 13:38:22 +0000 http://www.joeberkovitz.com/blog/?p=37#comment-84 Tom, Thanks for the great comments. (I also took a look at your blog and responded to a much earlier comment you made about the question of why there isn't a unitary Model object somewhere. Briefly, the answer is -- there certainly can be such an object and in many cases it's a good idea, but for the particular case of ReviewTube it doesn't seem to make sense to me.) 1/ About the Parameter objects, I assume those are internal to the Service/Operation part of the architecture and don't make it into the Service interface that the rest of the app calls. If they are indeed internal, then it sounds like a fine solution to your problem -- presumably you have various stock parameters for your HTTP requests and this gives you a way to encapsulate their structure. If they are exposed as a public data type, then the app developer has to pass a FooBarParameter object into each Service method, which seems like a big nuisance if the parameter is just a String, an int, or whatever. 2/ Questions about ViewStates and things like them come up a lot because they fall into a gray area. When is a ViewState a separate model-like object and not just some property of some view somewhere? My feeling is that a persistent ViewState is a perfectly legitimate *kind* of model, but not the same model-with-a-capital-M that represents the semantic data for the application. The fact that it gets persisted is a very good argument for separating it from the actual view components themselves. I certainly would want to keep ViewStates in a separate object, possibly living in the Controller (since the controller presumably plays some role in applying these states to the view). Hope this helps! Tom,

Thanks for the great comments.

(I also took a look at your blog and responded to a much earlier comment you made about the question of why there isn’t a unitary Model object somewhere. Briefly, the answer is — there certainly can be such an object and in many cases it’s a good idea, but for the particular case of ReviewTube it doesn’t seem to make sense to me.)

1/ About the Parameter objects, I assume those are internal to the Service/Operation part of the architecture and don’t make it into the Service interface that the rest of the app calls. If they are indeed internal, then it sounds like a fine solution to your problem — presumably you have various stock parameters for your HTTP requests and this gives you a way to encapsulate their structure. If they are exposed as a public data type, then the app developer has to pass a FooBarParameter object into each Service method, which seems like a big nuisance if the parameter is just a String, an int, or whatever.

2/ Questions about ViewStates and things like them come up a lot because they fall into a gray area. When is a ViewState a separate model-like object and not just some property of some view somewhere? My feeling is that a persistent ViewState is a perfectly legitimate *kind* of model, but not the same model-with-a-capital-M that represents the semantic data for the application. The fact that it gets persisted is a very good argument for separating it from the actual view components themselves. I certainly would want to keep ViewStates in a separate object, possibly living in the Controller (since the controller presumably plays some role in applying these states to the view).

Hope this helps!

]]>
By: Tom Lee http://joeberkovitz.com/blog/2006/12/29/dev-net-blueprint-article/comment-page-1/#comment-83 Tom Lee Wed, 23 May 2007 02:11:28 +0000 http://www.joeberkovitz.com/blog/?p=37#comment-83 I've been working through the process of architecting an application based on MVCS, and I thought I'd share some thoughts I had along the way. Forgive me if I get a bit long-winded, and please let me know if it sounds like I'm misunderstanding something fundamental. First, I found it useful to create a set of Parameter objects to be passed into the Operations - this way, each parameter is strongly typed, and it is this parameter object which is passed through the Service object, into the Operation (simplifying the method signatures). The Parameter objects all inherit from the same base class, which has a toSimpleObject method which returns an object containing name/value pairs (HTTPService requires a simple object - strongly typed objects won't work). In my case, each web service call required around 10 parameters, so changes in the web services became more difficult to manage. If the parameters of a web service changed, I had to update them in the service interface, the service object, and the operation object. With a Parameter object, the changes are in one location only. Now to decide where to put the darn things - do they belong in the Services packages, the Operations package, or are they more properly part of the Model? Secondly, I'm thinking a "ViewState" object would be a useful addition to the architecture. It would store any view object's properties that you might wish to save for later restoration, but that don't really belong in the model. For example, you might have a preferences PopUp dialog with some comboboxes whose selected indexes you'd like to persist each time the PopUp is shown. For some reason it doesn't feel right to put those kinds of things in the Model, but maybe that's exactly where they belong...? Care to comment? Thanks a lot for your article. It has taken me a giant step forward! I’ve been working through the process of architecting an application based on MVCS, and I thought I’d share some thoughts I had along the way. Forgive me if I get a bit long-winded, and please let me know if it sounds like I’m misunderstanding something fundamental.

First, I found it useful to create a set of Parameter objects to be passed into the Operations – this way, each parameter is strongly typed, and it is this parameter object which is passed through the Service object, into the Operation (simplifying the method signatures). The Parameter objects all inherit from the same base class, which has a toSimpleObject method which returns an object containing name/value pairs (HTTPService requires a simple object – strongly typed objects won’t work). In my case, each web service call required around 10 parameters, so changes in the web services became more difficult to manage. If the parameters of a web service changed, I had to update them in the service interface, the service object, and the operation object. With a Parameter object, the changes are in one location only. Now to decide where to put the darn things – do they belong in the Services packages, the Operations package, or are they more properly part of the Model?

Secondly, I’m thinking a “ViewState” object would be a useful addition to the architecture. It would store any view object’s properties that you might wish to save for later restoration, but that don’t really belong in the model. For example, you might have a preferences PopUp dialog with some comboboxes whose selected indexes you’d like to persist each time the PopUp is shown. For some reason it doesn’t feel right to put those kinds of things in the Model, but maybe that’s exactly where they belong…? Care to comment?

Thanks a lot for your article. It has taken me a giant step forward!

]]>