我经常听到人们称赞 Web 应用程序(相对于桌面应用程序)的便携性。事实上,使桌面应用程序在多个操作系统上可用是很困难的。但是,我认为 Web 应用程序必须同样好地处理可移植性问题,只是在浏览器之间而不是在操作系统之间。还是做一个跨浏览器的web应用不难?
6 回答
Of course you are right that there are cross browser compatibility issues with writing web applications. But, as with desktop application development, there are frameworks and libraries you can use that will deal with this for you (e.g. JQuery, Google Web Toolkit, Yahoo UI).
One thing that stands out as being simpler with web applications is having a consistent look and feel across platforms. Browsers all use CSS and generally have consistent looking form elements (or will use the appropriate elements for the platform). With desktop applications a cross platform native look and feel is more difficult to achieve. One of the big criticisms for using Java for cross platform GUIs is that even when you use the platform look and feel it is not native enough. I am not sure whether libraries like Qt are better in this regard.
Just keep in mind that for web applications, there are two levels of portability.
First and most important, the browser portability. But if the application has to run on more webservers, there is also server side portability. Most of the time you decide linux vs windows. But there are other issues (for example php version requirements).
It all depends on what exactly you are trying to build. Some toolkits like the QT toolkit allow quite easy and fast compilation and cross platform portability. Web Apps are quite trendy and "in" at the moment as the culture of the Net is all to do with Mashups, distribution and what not. The problem is that this was never really envisaged when most browsers were made though they are getting faster. Thin Clients such as Google Docs and what not are indeed very useful but cant quite compete head to head with a desktop version but then, they arent trying to. its mainly down to what you use them for.
如果一个 Web 应用程序根据 MVC 模式精心设计,那么视图部分(页面)已经被移植。
如果业务层和数据层设计良好(不是意大利面条式代码)并且没有混合,那么它们也可以轻松移植(但对于桌面应用程序也是如此)。
无论如何,Web 应用程序已经被移植——您可以在许多平台上的许多浏览器中使用它们。
是的,您通常可以构建非常高交互性和丰富的 Web 应用程序,不幸的是,由于使用的工具、浏览器不兼容等原因,开发过程要复杂得多。但是像 Silverlight 这样的东西让它变得更容易了。
仍然有很多地方更适合桌面应用程序。