简体   繁体   English

我应该怎么做才能开发出结构良好的C ++程序?

[英]What should I do to develop a well structed C++ program?

Right now, I want to develop a C++ program. 现在,我想开发一个C ++程序。 And the UI design is the difficult issue. UI设计是一个难题。 my question is: 1. is there any good practice for developing a well structed c++ program ? 我的问题是:1.开发良好结构的c ++程序是否有任何好的做法? 2. is there any good practice for developing UI in c++? 2.在c ++中开发UI是否有好的做法? 3. I usually heard of Activex in C++, can it use to encapsulate a UI, and is good for maintain after software is finished. 3.我通常听说过C ++中的Activex,它可以用来封装UI,并且对软件完成后的维护有好处。

Thanks in advance ! 提前致谢 !

I try to give some answers to your questions: 我尝试给您的问题一些答案:

1) Good Program Structure 1)良好的程序结构

This really depends on what matters most - cost of development, ease of deployment/update, maintainability, target machine requirements. 这实际上取决于最重要的因素-开发成本,易于部署/更新,可维护性,目标机器要求。 It is hard to give you a good answer because the topic is so large. 由于主题如此之大,很难给您一个很好的答案。 I suggest this as a good place to start reading: 我建议将其作为开始阅读的好地方:

Software Design 软件设计

(2) Good Practice for developing UI (2)开发UI的良好做法

This really does depend on what technology you are going to use. 这确实取决于要使用的技术。 If you're running on Windows, you have a handful of options: 如果您在Windows上运行,则有几种选择:

a) Win32 API programming a)Win32 API编程

This is the hardest and involves writing code to call functions like 'CreateWindow' to create your UI a piece at a time. 这是最难的,需要编写代码来调用诸如“ CreateWindow”之类的函数来一次创建您的UI。

b) ATL - Active Template Library b)ATL-活动模板库

This is a bit easier than (1) but uses really hardcore C++ - you need to know about Templates, Multiple Inheritance, some Patterns and you'll end up learning Win32 anyway. 这比(1)容易一些,但使用的是真正的C ++-您需要了解模板,多重继承,某些模式,否则无论如何您最终都会学习Win32。

c) Microsoft Foundation Classes (MFC) c)Microsoft基础类(MFC)

If you have Visual C++ or Visual Studio, you can create an MFC project which has dialog editors and a UI framework to more easily create rich user interfaces. 如果您使用Visual C ++或Visual Studio,则可以创建一个MFC项目,该项目具有对话框编辑器和UI框架,可以更轻松地创建丰富的用户界面。 Microsoft Outlook is written in MFC. Microsoft Outlook是用MFC编写的。

d) Use C#.net d)使用C#.net

If you have Visual Studio, then I would recommend that you make your UI in Visual C# using the Forms Designer tool as it is quite easy to create a flexible and responsive UI. 如果您拥有Visual Studio,那么我建议您使用窗体设计器工具在Visual C#中创建UI,因为创建灵活的响应式UI非常容易。 You can still do all your business logic in C++ and link to it from the C#. 您仍然可以使用C ++进行所有业务逻辑,并从C#链接到它。 It is also the newest of all these options. 它也是所有这些选项中最新的。

3) ActiveX 3)ActiveX

For all options (a), (b), (c), (d) you can make an ActiveX control to make your program re-usable. 对于所有选项(a),(b),(c),(d),您都可以使ActiveX控件使程序可重复使用。 You can also make an ActiveX control in Visual Basic. 您还可以在Visual Basic中制作ActiveX控件。

Hope this helps! 希望这可以帮助!

James 詹姆士

您可能还考虑使用Qt-C ++跨平台UI框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我的c ++程序在没有输入的情况下终止。我该怎么办? - My c++ program terminated without taking the input.What should i do? OpenCV/C++ 程序比它的 numpy 程序慢,我该怎么办? - OpenCV/C++ program slower than its numpy counterpart, what should I do? 我无法在任何文本编辑器上执行 C++ 程序文件。 我现在该怎么办? - I am unable to execute C++ program files on any of the text editors. What should I do now? 如果要将Python嵌入C ++程序,应该在程序的文件夹中放什么? - What should I put in the folder of my program if I want to embed Python to a C++ program? 对于 C 中的以下代码,我应该在 C++ 中做什么? - what should I do in C++ for following code in C? 我应该怎么做才能扩展C ++中的输出值 - What should I do to extend output values in c++ 图形程序无法在Borland C ++中运行,我该怎么办? - Graphics program not run in Borland c++ ,what i do? 我需要什么C ++程序包才能运行程序? - What C++ packages do i need to run a program? 我需要什么C ++库来编译这个程序 - What C++ library do I need to get this program to compile 如果我想获取 C++ 程序的行,我应该写什么格式的 my.txt 文件? - What format should I write my .txt file if I want to getline for C++ program?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM