在现实生活中的应用程序开发中使用设计模式 [英] use of design patterns in real life application development

查看:125
本文介绍了在现实生活中的应用程序开发中使用设计模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#开发桌面应用程序.我想使用设计模式,但是没有使用它们的经验.我在网上搜索过,但找不到像初学者一样对我有用的任何良好示例. 他们有一些代码来演示设计模式,但是我不明白在开发应用程序时如何使用它们..
##开发现实生活中的应用程序时如何实现设计模式,请任何人指导我,例如C#的桌面应用程序
##我们也可以将设计模式与sql代码一起使用吗?

I am developing a desktop application using C#. I want to use design patterns but do not have any experience in using them. I searched in net but can not found any good examples helpful for me like beginners. They have some block of codes to demonstrate the design patterns but I can not understand how can I use them when I develop my applications.
## How can I implement design patterns when developing real life applications, please can anyone guide me e.g. desktop application with C#
## Can we use design patter with sql code too?

推荐答案

这个问题没有什么意义.仅演示一种或两种模式的实现几乎对您没有帮助.您没有给我们任何使用一个或另一个模式的理由.并且大量展示它们几乎是不可行的,根本没有任何意义.毕竟,您已经找到了一些演示设计模式的代码块",但是它对您没有帮助,那么为什么还要一些示例帮助呢?我对此表示怀疑.

我认为您只是想朝错误的方向前进.也许您正试图突破敞开的大门.您需要了解的第一件事是:实现某些设计模式不能成为您项目的目标之一.换句话说,描述了设计模式可以帮助您的某些项目,但是不应将项目设计为实现设计模式. 不要交换工作的目标和有助于工作的工具.

合理的人通常会使用以下设计模式:

首先,他们尝试从一侧的体系结构开始设计软件系统,然后从另一侧尝试对某些技术元素进行原型设计,弄清楚应该开发和重用哪些库单元.然后,在您的设计和进一步的工作中,他们面临一些问题.重要的是要很好地实现它们,而不是立即跳到解决方案,而是要着手解决问题的本质,本质,避免临时解决.换句话说,停下来思考一下.重要的是要了解开发是迭代的,因此您可以在开发的整个生命周期中多次进入此阶段. 只有在这样的发展阶段中,当问题得到很好的解决时,您才能想到:而其他人在类似情况下做了什么?然后,您可以刷新对现有设计模式的记忆,或者阅读它们,或者扫描它们的列表,然后思考:一个或另一个模式可以帮助我的工作吗?" 会有所帮助.

另外,您还需要了解,您的项目可能需要也可能不需要某些创造性的方法,即创建一些已知模式甚至新模式的特殊变体.同时,可以按原样使用许多模式.这取决于许多不同的因素.在某些框架中已经实现了许多小的模式.

抱歉,仅此而已,因为您没有与我们分享任何细节.

—SA
This question makes very little sense. The demonstration of just one or two implementation of the patterns will hardly help you. You did not give us any reasons to use one or another patters. And demonstration of big number of them would be hardly feasible and won''t make any sense at all. After all, you already found some "block of codes to demonstrate the design patterns", and it did not help you, so why would some more sample help? I doubt it.

I think you are just trying to move in wrong direction. Or perhaps you are trying to break through the open door. First thing you need to understand is: implementing of some design patterns cannot be one of the goals of your project. In other words, design patterns are described to help some of your project, but the project should not be designed to implement design patterns. Don''t swap the goal of you work and the tools helping you in your work.

Here is what reasonable people usually do with design patterns:

First, they try to design the software system, starting from the architecture from one side, and, from another side, trying to prototype some technology elements, figure out what library units should be developed and reused. Then, in your design and further work, they face with some problems. It''s important to realize them well, not jumping to the solutions right away, try to get to the very nature, essence of the problem, avoiding ad-hoc resolution. In other words, make a pause for some thinking. It''s important to understand that the development is iterative, so you can come to this phase more than once during the life cycle of development. And only in such a phase of development, when the problem is well realized, you can think: and what other people did in similar situations? And then you can refresh your memories on existing design patterns, or read about them, or scan a list of them, trying to think: "can one or another pattern help my work?" And only then some code samples could be helpful.

Also you need to understand that your project may or may not require some creative approach, creating of some specialized variants of known patterns or even new patterns. At the same time, many patterns can be used as is. It depends on many different factors. Many small patterns are already implemented in some framework.

Sorry, but that''s all, because you did not share with us any detail.

—SA


这篇关于在现实生活中的应用程序开发中使用设计模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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