什么被认为是一个程序的正确结构 [英] What is concidered to be the proper stucture for a program

查看:70
本文介绍了什么被认为是一个程序的正确结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用OO编写了一个程序,发现它并不像我想的那样通用。由于存在大量依赖性,因此更改很困难。所以我决定重新编写程序,在这样做的过程中,我一直在研究当前的实践。我看到了新的东西,比如工厂方法,依赖注入,继承,扩展,实现和接口。



我提到的每种模式都有大量的在线示例但是我需要的是一个模板,概述了它们应该如何相互结合使用。我的程序需要使用监听器和共享资源,如列表。我在学习如何围绕共享资源构建程序时遇到了麻烦。



任何人都可以指向我结构化编程的基本模板,演示这些类型的模式,应该相互结合使用?



提前谢谢你,我希望我的声音听起来不是太愚蠢。 XD ...



我的尝试:



我搜索过互联网也发布在StackOverflow上,这让我因为没有问正确的方法而被禁止。

I have written a program using OO and found that its not as versatile as I would like. Changes are difficult as there are a lot of dependencies. So I have decided to re-write the program and in doing so, I have been doing some research into current practices. I see new things like factory methods, dependency injection, inheritance, extension, implementation and interfaces.

There are lots of examples online for each of the patterns I mentioned but what I need is a template, outlining how they should be used in conjunction with each other. My program will need to use listeners and shared resources such as Lists. I have found trouble in learning how I should structure my program around a shared resource.

Can anyone point me to a basic template for structured programming, demonstrating how these sorts of patterns, should be used in conjunction with each other?

Thank you in advance and I hope I didn't just sound too dumb. XD...

What I have tried:

I searched the internet and also posted on StackOverflow which got me banned for not asking the correct way.

推荐答案

对于这样的问题,没有简单的答案或模板。程序设计是一个迭代过程,从基本的业务问题细节开始,逐步发展到详细的需求,设计和代码。如上所述,模式的使用只会随着设计的进展而变得明显,并且您可能会发现在最终产品中需要一些,全部或不需要它们。进一步阅读设计论文和教程可以帮助您做出决定。
There is no simple answer, or template, for such a question. Program design is an iterative process, starting with the basic business problem details, and progressing to the detailed requirements, design and code. The use of patterns such as you mention above will only become obvious as your design progresses, and you may find you need some, all or none of them in your final product. Further reading of design papers and tutorials may help you to make decisions along the way.


这篇关于什么被认为是一个程序的正确结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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