wpf 如何在开发 Web 应用程序和桌面应用程序之间做出决定

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45292551/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 14:07:48  来源:igfitidea点击:

How to decide between developing a web application and a desktop application

c#phpwpfdesktop-applicationweb-application-project

提问by JonTan

I am a software engineer intern for a manufacturing company and they want me to develop an application for the company. They are leaning towards a web application however, I wish to know whether a desktop application would better fit the job. Therefore, I have been googling and looking through stackoverflow to find out what the pros and cons between desktop applications and web applications are. The following is essentially what I found:

我是一家制造公司的软件工程师实习生,他们希望我为公司开发应用程序。然而,他们倾向于使用 Web 应用程序,我想知道桌面应用程序是否更适合这份工作。因此,我一直在谷歌搜索并查看 stackoverflow,以找出桌面应用程序和 Web 应用程序之间的优缺点。以下基本上是我发现的:

Quick disclaimer, I have background in C# and WPF so I am a bit biased as it would be easier for me to develop a desktop application. I have no web experience so there is nothing I can really talk about in that area which is why I wish to know more about whether this application is better suited as a web application or desktop application. I am absolutely open to learning Php and web development to expand my abilities. I have started (a bit) looking into developing the web application using Php7 with Laravel framework.

快速免责声明,我有 C# 和 WPF 的背景,所以我有点偏见,因为我开发桌面应用程序会更容易。我没有网络经验,所以在那个领域我没有什么可以真正谈论的,这就是为什么我想更多地了解这个应用程序是否更适合作为网络应用程序或桌面应用程序。我绝对愿意学习 PHP 和 Web 开发以扩展我的能力。我已经开始(有点)研究使用 PHP7 和 Laravel 框架开发 Web 应用程序。

Pros of desktop applications:

桌面应用程序的优点:

  1. Typically faster than Web Applications (Assuming web application will perform complex queries, calculations, etc, and not just display markups)
  2. Development of GUIs is faster
  3. More secure as desktop applications are private by default.
  4. There are more available controls allowing for a more rich and interactive experience for user (Or at least, these controls are easier/faster to implement on desktop based applcations compared to a web-based application)
  5. Can take advantage of user hardware.
  1. 通常比 Web 应用程序更快(假设 Web 应用程序将执行复杂的查询、计算等,而不仅仅是显示标记)
  2. GUI 的开发速度更快
  3. 更安全,因为桌面应用程序默认是私有的。
  4. 有更多可用控件为用户提供更丰富的交互体验(或者至少,与基于 Web 的应用程序相比,这些控件在基于桌面的应用程序上更容易/更快地实现)
  5. 可以利用用户硬件。

Cons of desktop applications:

桌面应用程序的缺点:

  1. Use/deployment is limited by system (However, this should not be a problem because all our systems are Windows based.)
  2. Updates and installation must be manually implemented.
  3. If every client desktop gets a database connection, scaling is not good as database suffers from heavy load. (However, this probably will not be the case since we won't have more than 500 users).
  1. 使用/部署受系统限制(但是,这应该不是问题,因为我们所有的系统都是基于 Windows 的。)
  2. 更新和安装必须手动实施。
  3. 如果每个客户端桌面都有一个数据库连接,则扩展性不好,因为数据库负载很重。(但是,情况可能不会如此,因为我们的用户不会超过 500 个)。

Pros of web application

Web 应用程序的优点

  1. Cross platform (No need to deal with different operating systems) so it is easily portable
  2. Development is quick and easy
  3. Deployment is easy as updates are automatic and server side.
  4. Large community support and available frameworks.
  1. 跨平台(不需要处理不同的操作系统)所以它很容易移植
  2. 开发快速简便
  3. 部署很容易,因为更新是自动的和服务器端。
  4. 大型社区支持和可用框架。

Cons of web application

Web 应用程序的缺点

  1. Larger overhead (Applications tend to be slower due to need to transmit data across the internet).
  2. Need to deal with different browsers. Javascript most likely needs to be tweaked to be perfect on one web platform (Chrome, Firefox, etc) and will not be perfect on the others. (However, this is not that big of a deal).
  3. Security is an issue since data will be public.
  1. 更大的开销(由于需要通过互联网传输数据,应用程序往往会变慢)。
  2. 需要处理不同的浏览器。Javascript 很可能需要在一个 Web 平台(Chrome、Firefox 等)上进行调整才能完美,而在其他平台上则不完美。(然而,这不是什么大不了的事)。
  3. 安全是一个问题,因为数据将是公开的。

Please let me know if any of the above is outdated (most of the posts I found were from 2011 or prior) or wrong. Also, if there is any other pro/con to consider.

如果以上任何内容已过时(我发现的大多数帖子都来自 2011 年或更早)或错误,请告诉我。此外,如果有任何其他利弊要考虑。

Moving on to the application description....

转到应用程序说明....

Background on the company: We build and process dozens of different parts every day. For each type of part, after X amount of the part is processed, a sample needs to be taken for inspection. So for example, part Y has 3 samples taken every 120 minutes to be inspected (Because the machine typically finishes processing X amounts in 120 minutes). The inspection results (measurement data) are then stored in the database (MySQL database).

公司背景:我们每天制造和加工数十种不同的零件。对于每种类型的零件,在加工 X 量零件后,都需要取样进行检查。例如,零件 Y 每 120 分钟抽取 3 个样本进行检查(因为机器通常在 120 分钟内完成处理 X 个数量的样品)。然后将检查结果(测量数据)存储在数据库(MySQL 数据库)中。

General summary of the application's purpose:

应用程序目的的一般摘要:

  1. View the schematics of all the parts we design (We store all the schematics as pdfs on a network drive, so this is simply just pulling up the specific pdf requested from the drive and displaying it onto the application).
  2. View/update the status of all the machines in the company (What parts are they working on, are they online/offline, etc). A certain user (Inspector) will use this application to update machine status/information. Then another user (Operator) will use the application to view the statuses.
  3. Monitor part inspections. So, for every machine and part being processed, there will be a timer to let a Operator user know when a certain part needs to be submitted for inspection. Upon part submission, an inspector will then receive a notification to inspect the part, and after letting the application know that they completed the inspection, the timer will restart to let the operator know whens the next time they need to submit a part.
  4. The application will calculate statistical data (For example, Cpk values) from the part measurements obtained from inspection results and display the statistical data along with a graph/chart.
  1. 查看我们设计的所有部件的原理图(我们将所有原理图以 pdf 格式存储在网络驱动器上,因此这只是从驱动器中提取请求的特定 pdf 并将其显示在应用程序上)。
  2. 查看/更新公司所有机器的状态(它们在加工什么部件,它们是否在线/离线等)。某个用户(检查员)将使用此应用程序来更新机器状态/信息。然后另一个用户(操作员)将使用该应用程序查看状态。
  3. 监控零件检查。因此,对于正在处理的每台机器和零件,都会有一个计时器,让操作员用户知道何时需要提交某个零件进行检查。提交零件后,检查员将收到检查零件的通知,在让应用程序知道他们完成了检查后,计时器将重新启动,让操作员知道下次需要提交零件的时间。
  4. 该应用程序将根据从检查结果中获得的零件测量值计算统计数据(例如,Cpk 值),并将统计数据与图形/图表一起显示。

I hope I explained all of this clearly enough. Some other things to note, from my understanding, the users will not need remote access. This application will pretty much only be used on company site. Also, the original reason that the company wanted a web application was because operators will be using a tablet for the application and the tablets they acquired were original android based. However, they decided to switch to using Windows Surface tablets so WPF applications are now a possibility.

我希望我已经足够清楚地解释了所有这些。其他一些需要注意的事情,据我所知,用户不需要远程访问。此应用程序几乎只能在公司网站上使用。此外,该公司想要一个 Web 应用程序的最初原因是因为运营商将使用平板电脑来运行该应用程序,而他们购买的平板电脑是基于安卓的原始平板电脑。但是,他们决定改用 Windows Surface 平板电脑,因此现在可以使用 WPF 应用程序。

With all of this being said, I am really looking for input on what route people with more experience would recommend. I am still in college so please forgive my lack of knowledge/experience. What else should I be thinking about when deciding between a web application and desktop application?

说了这么多,我真的在寻找关于有更多经验的人会推荐什么路线的意见。我还在上大学,所以请原谅我缺乏知识/经验。在 Web 应用程序和桌面应用程序之间做出决定时,我还应该考虑什么?

Here are some of the pages I have seen while pondering this topic:

以下是我在思考这个话题时看到的一些页面:

  1. Advantages of web applications over desktop applications
  2. https://www.quora.com/How-much-different-is-it-to-build-a-web-application-vs-a-desktop-application
  3. https://www.quora.com/What-are-the-advantages-and-disadvantages-of-web-based-application-development-vs-desktop-application-development
  1. Web 应用程序相对于桌面应用程序的优势
  2. https://www.quora.com/How-much-different-is-it-to-build-a-web-application-vs-a-desktop-application
  3. https://www.quora.com/What-are-the-advantages-and-disadvantages-of-web-based-application-development-vs-desktop-application-development

There were more stackoverflow pages but the one listed above pretty much has everything that the other pages stated.

有更多的 stackoverflow 页面,但上面列出的页面几乎包含了其他页面所说的所有内容。

EDIT: Seems like web-application is winning so far (Not that I mind at all, I am actually excited to develop a web-application based off what I am hearing). Is there anyone who would rather do a desktop application? If so, why?

编辑:到目前为止,似乎网络应用程序正在获胜(我一点也不介意,我实际上很高兴根据我所听到的内容开发网络应用程序)。有没有人更愿意做一个桌面应用程序?如果是这样,为什么?

回答by Baim Wrong

Sounds like assembling or similar company work proccess monitoring to me.

对我来说听起来像是组装或类似的公司工作流程监控。

If i have to build this application then first i will search and do some research if the function you want is possible and easy to develop with the programming language you will use

如果我必须构建这个应用程序,那么首先我会搜索并做一些研究,如果你想要的功能是可能的并且很容易用你将使用的编程语言开发

for example, if i choose to develop using web based then :

例如,如果我选择使用基于 Web 的开发,那么:

Larger overhead (Applications tend to be slower due to need to transmit data across the internet).

更大的开销(由于需要通过互联网传输数据,应用程序往往会变慢)。

you can use intranet and good spec server computer

您可以使用内联网和良好规格的服务器计算机

Need to deal with different browsers. Javascript most likely needs to be tweaked to be perfect on one web platform (Chrome, Firefox, etc) and will not be perfect on the others. (However, this is not that big of a deal).

需要处理不同的浏览器。Javascript 很可能需要在一个 Web 平台(Chrome、Firefox 等)上进行调整才能完美,而在其他平台上则不完美。(然而,这不是什么大不了的事)。

then set the standard browser for working in your workplace

然后设置标准浏览器以在您的工作场所工作

View the schematics of all the parts we design (We store all the schematics as pdfs on a network drive, so this is simply just pulling up the specific pdf requested from the drive and displaying it onto the application).

查看我们设计的所有部件的原理图(我们将所有原理图以 pdf 格式存储在网络驱动器上,因此这只是从驱动器中提取请求的特定 pdf 并将其显示在应用程序上)。

you can upload pdf to server and view it within browser using pdf viewer plugin like pdfjsor similar plugin

您可以将pdf上传到服务器并使用pdf查看器插件(如pdfjs或类似插件)在浏览器中查看

View/update the status of all the machines in the company (What parts are they working on, are they online/offline, etc). A certain user (Inspector) will use this application to update machine status/information. Then another user (Operator) will use the application to view the statuses

查看/更新公司所有机器的状态(它们在加工什么部件,它们是否在线/离线等)。某个用户(检查员)将使用此应用程序来更新机器状态/信息。然后另一个用户(操作员)将使用该应用程序查看状态

is the machine have ip ? can i use ping function to the machine to determine the machine is online or not to ease the task ? if not then what is the schedule of the inspector to inspect the machine ? of course the inspector can login to the system then update the machine status manually using web application

机器有ip吗?我可以使用 ping 功能到机器来确定机器是否在线以减轻任务吗?如果没有,那么检查员检查机器的时间表是什么?当然,检查员可以登录系统,然后使用 Web 应用程序手动更新机器状态

Monitor part inspections. So, for every machine and part being processed, there will be a timer to let a Operator user know when a certain part needs to be submitted for inspection. Upon part submission, an inspector will then receive a notification to inspect the part, and after letting the application know that they completed the inspection, the timer will restart to let the operator know whens the next time they need to submit a part.

监控零件检查。因此,对于正在处理的每台机器和零件,都会有一个计时器,让操作员用户知道何时需要提交某个零件进行检查。提交零件后,检查员将收到检查零件的通知,在让应用程序知道他们完成了检查后,计时器将重新启动,让操作员知道下次需要提交零件的时间。

this one sounds like scheduling mechanics to ensure the quality, you can make a timer with jquery and using ajax to send notification to the operator with specific data about certain part that need to be inspected

这听起来像是确保质量的调度机制,您可以使用 jquery 制作计时器并使用 ajax 向操作员发送通知,其中包含有关需要检查的某些部分的特定数据

The application will calculate statistical data (For example, Cpk values) from the part measurements obtained from inspection results and display the statistical data along with a graph/chart.

该应用程序将根据从检查结果中获得的零件测量值计算统计数据(例如,Cpk 值),并将统计数据与图形/图表一起显示。

this one is depends on your statistic formula, you can use highchartplugin for this one

这个取决于你的统计公式,你可以使用highchart插件来做这个

the second one after you ensure your choosen programming language able to accomplish the task you want is to design the database structure

确保您选择的编程语言能够完成您想要的任务后的第二个是设计数据库结构

Quote by Linus Torvalds :

莱纳斯·托瓦兹 (Linus Torvalds) 的引述:

"Bad programmers worry about the code. Good programmers worry about data structures and their relationships."

“糟糕的程序员担心代码。好的程序员担心数据结构及其关系。”

Have a nice day, good luck with deciding after give it some good thinking to avoid development problem in the future

祝你有美好的一天,祝你在给它一些好的思考之后做出决定以避免未来的发展问题

回答by LoztInSpace

I'm inherently biased against web apps. They're difficult to get right due to browsers, they're typically insecure (by accident though). The platform sucks (JavaScript and the bazillion libraries from random people/orgs), "everything is a string". I could go on.

我天生就对网络应用程序有偏见。由于浏览器的原因,它们很难正确,它们通常不安全(尽管是偶然的)。该平台很糟糕(JavaScript 和来自随机人员/组织的无数库),“一切都是一个字符串”。我可以继续。

However it's undeniably the best platform for reaching a wide, public audience and allowing continual updates.

然而,不可否认,它是覆盖广泛的公众受众并允许持续更新的最佳平台。

In a corporate environment the advantages do tend to go away, but not entirely. Updates, for example can be achieved generally by storing all your .exe & DLLs in a shared directory. As you say, you can build a much richer UI quicker and cheaper using the Windows platform.

在企业环境中,优势确实会消失,但不会完全消失。例如,更新通常可以通过将所有 .exe 和 DLL 存储在共享目录中来实现。正如您所说,您可以使用 Windows 平台更快、更便宜地构建更丰富的 UI。

With regards to your architecture, something that has worked for me in a similar situation is to have a Windows front end, but also have the guts of the business logic, data access (connection pooling) and processing off on a stateless web server (or two) accessed from the UI via Web Services (protocol of your choice - I prefer SOAP due to WCF and WSDL but plenty of folks won't).

关于您的架构,在类似情况下对我有用的东西是拥有 Windows 前端,但也有业务逻辑、数据访问(连接池)和无状态 Web 服务器上的处理(或二)通过 Web 服务从 UI 访问(您选择的协议 - 由于 WCF 和 WSDL,我更喜欢 SOAP,但很多人不会)。

This allows for centralised data access and a place to put your one-off batch jobs or calculations that can then be shared. It also has the advantage that if you need to do something really intensive, not every client machine has to have that capability.

这允许集中数据访问和放置一次性批处理作业或计算的地方,然后可以共享。它还有一个优点,如果你需要做一些非常密集的事情,并不是每台客户端机器都必须具备这种能力。

Your situation seems to fit this model but without a lot of insider knowledge it's primarily opinion, but possibly one to consider.

你的情况似乎符合这个模型,但没有很多内幕知识,这主要是意见,但可能需要考虑。