更好的设计 [英] Better Design

查看:73
本文介绍了更好的设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为以下用例寻找更好的设计方法。

i am looking for better design approach for below use case.

用例:

我正在开发Silverlight应用程序,在我的主页面中,我根据某些条件动态放置用户控件。我正在计划使用反射将这些用户控件添加到我的主页面。但是要显示所有数据这些用户控件需要
一些params.so我计划创建具有所有属性的单个类,并需要在这些用户控件之间共享。我将在加载Mainpage页面时更新此业务对象并需要使用反射实例化usercontrol对象并将
置于此。

I am developing Silverlight application and In my main page i am dynamically placing the usercontrols based on some conditions.And i am planing to use the reflection to add these user controls to my main page.But to display data all these user controls required some set of params.so i am planing to create single class with all properties and need to share among these user controls.and i will update this business object while loading the Mainpage page and need to use reflection to instantiate usercontrol object and placed into this.

对上述用例有什么更好的方法吗?任何一个例子?

Any better approach on this above use case? Any example?

谢谢

Vru

 

 

推荐答案

好的,首先是免责声明。你要阅读的内容可能不是更好的方法;这是一种替代方法,它基于从与你想做的事情类似的项目中得出的一些假设。

Ok start with a disclaimer. What your about to read might not be a better approach; it's an alternative approach based on some assumptions drawn from projects that did similar things to what your looking to do.

正确的就是这样。

创建一个描述屏幕配置方式的单一类的想法将是我如何做到这一点,但我认为使用反射没有任何好处。我想只有在类的属性未知的情况下才会使用反射,但是应该知道

The idea of creating a single class that describes how the screen is configured would be how I would do it but I don't see any advantage to using reflection. I'd imagine that reflection would only be used if the properties of the class weren't known, but they should be known.

策略模式可能对此有所帮助,但它取决于您的项目。

The strategy pattern might help here but it depends on your project.

您能否提供有关项目和单班的更多信息。例如,当设置为特定值时,有哪些属性以及UI的哪些部分会被创建?更具体,更高一级,关于​​什么
显示什么属性设置时UI中没有的东西。

Could you give some more information on the project and the single class. Like for example what properties are there and what parts of the UI wauld be created when they are set to certain values? Be a bit more specific, a bit more higher level, about what is shown what is not in the UI when what properties are set.


这篇关于更好的设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆