推荐使用MVC进行桌面应用程序开发的书籍 [英] Recommended books on Desktop Application development using MVC

查看:85
本文介绍了推荐使用MVC进行桌面应用程序开发的书籍的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找有关桌面上有关MVC的书籍的建议。如果他们使用Java,那就是奖金。

I'm looking for recommendations on books about MVC on the desktop. If they use Java, that is a bonus.

一些背景:
我正在用Java编写桌面应用程序。它是一个音频应用程序,具有许多视图和一个称为库的中央模型,其中包含播放列表,效果列表和用于组织它们的文件夹结构。在这个应用程序中,我想为各种用户操作提供菜单,上下文菜单和拖放支持。我一直在努力使用MVC来实现这个目标。

Some background: I'm writing a desktop application in Java. It's an audio application that has a number of views and a central model called a Library with playlists, effects lists and a folder structure to organize them. In this application I'd like to have menus, context-menus and drag and drop support for various user actions. I've been struggling with how to achieve this using MVC.

我从主类中的所有逻辑/控制器开始,但已经开始将它们分离成自己的类。现在我需要开始使用侦听器和观察器来处理视图和控制器之间的消息。这导致我创建了许多接口,并在几个地方通过我的监听器循环以触发各种消息。但是循环代码不断重复(而不是DRY),所以我假设现在我应该创建不同类型的Event类,在我的视图中创建这些事件,并在视图中使用单个方法将其发送给各种侦听器。

I started with all the logic/controllers in the main class but have started to separate them out into their own classes. Now I need to start using listeners and observers to handle messages between the views and the controller. This led to me creating a number of interfaces and looping through my listeners in several places to fire off various messages. But that loop code keeps getting repeated (not DRY), so I'm assuming that now I should create different types of Event classes, create those events in my views and use a single method within the view to fire it off to the various listeners.

更新: Arguabley它应该没关系,但我使用的是SWT,而不是Swing。

Update: Arguabley it shouldn't matter much but I'm using SWT, not Swing.

推荐答案

我遇到了同样的问题:编写一个(非平凡的)swing应用程序真的需要很多纪律,因为所有的侦听器和事件都是异步的对于大量无法维护的代码,处理速度非常快。

I've had the same problem: it really takes a lot of discipline to write a (non trivial) swing app, because all the listeners and events and asynchronous processing make up really fast for a big pile of unmaintainable code.

我发现经典的MVC还不够,你必须研究更具体的模式,比如演示模型等。我在应用于桌面应用程序时发现的唯一涵盖此模式的书是 Desktop Java Live ,作者:Scott Delap。虽然大多数摇摆书都涉及解决特定问题的技巧(如何制作无网格jtable,如何实现圆形按钮......),但Delap的书将帮助您构建中型摇摆应用程序,最佳实践等。

I found that classic MVC isn't enough, you have to look into more specific patterns like Presentation Model and such. The only book I found covering this patterns when applied to desktop applications is Desktop Java Live, by Scott Delap. While the majority of swing books deal with techniques to solve specific problems (how to make a gridless jtable, how to implement a round button, ...), Delap's book will help you architect a medium-sized swing application, best practices, etc.

这篇关于推荐使用MVC进行桌面应用程序开发的书籍的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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