推荐使用MVC进行桌面应用程序开发的书籍

时间:2021-12-28 08:35:14

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

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

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.

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

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.

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

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

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

6 个解决方案

#1


8  

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.

我遇到了同样的问题:编写一个(非平凡的)swing应用程序确实需要很多纪律,因为所有的侦听器和事件以及异步处理对于大量不可维护的代码来说非常快。

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是不够的,你必须研究更具体的模式,如Presentation Model等。当我应用于桌面应用程序时,我发现的唯一涵盖此模式的书是Scott Delap的Desktop Java Live。虽然大多数摇摆书都涉及解决特定问题的技巧(如何制作无格式jtable,如何实现圆形按钮,......),Delap的书将帮助您构建中型摇摆应用程序,最佳实践等。

#2


2  

Pretty much any java, eclipse, netbeans swing books should to the trick.

几乎任何java,eclipse,netbeans摇摆书都应该成功。

1) FREE --- Thinking in Java (http://mindview.net/Books/TIJ/DownloadSites)
2) CORE java , vol 1 and 2
3) Swing hacks : http://www.amazon.com/Swing-Hacks-Tips-Tools-Killer/dp/0596009070
4) netbeans RCP : http://www.amazon.com/Rich-Client-Programming-Plugging-NetBeans/dp/B00132S6UU/ref=dp_kinw_strp_1 5) eclipse Rich client programming -- http://www.amazon.com/Eclipse-Rich-Client-Platform-Applications/dp/0321334612

1)*---用Java思考(http://mindview.net/Books/TIJ/DownloadSites)2)CORE java,第1卷和第2卷3)Swing hacks:http://www.amazon.com/Swing- Hacks-Tips-Tools-Killer / dp / 0596009070 4)netbeans RCP:http://www.amazon.com/Rich-Client-Programming-Plugging-NetBeans/dp/B00132S6UU/ref=dp_kinw_strp_1 5)eclipse富客户端编程 - - http://www.amazon.com/Eclipse-Rich-Client-Platform-Applications/dp/0321334612

Hope this helps.

希望这可以帮助。

BR,
~A

#3


2  

In C# rather then Java, but Jeremy Miller has a bunch of posts regarding desktop apps and MVP/MVC (and a whole bunch of other related stuff).

在C#而不是Java中,但是Jeremy Miller有很多关于桌面应用程序和MVP / MVC(以及其他一些相关内容)的帖子。

#4


1  

Just to throw in my 2 cents, I recommend the book Head First Design Patterns. It has a very good explanation of the MVC pattern (in Java). It builds on other design patterns also discussed in the book such as Observer, Strategy and Composite that are used in MVC.

只要投入2美分,我就推荐Head First Design Patterns这本书。它对MVC模式有很好的解释(在Java中)。它建立在本书中讨论的其他设计模式的基础上,如MVC中使用的Observer,Strategy和Composite。

Best MVC tutorial I've read. Highly recommended.

我读过的最好的MVC教程。强烈推荐。

#5


0  

Don't forget the Swing Tutorials; for instance the Swing Events tutorial.

不要忘记Swing教程;例如Swing Events教程。

And please bear in mind the SwingWorker, or handling events in a separate worker thread. I'm no expert on Swing by any means but I do know that a lot of the perceived slowness of Java Desktop applications is due to the work done in the event thread. If such work takes some time the entire GUI is unresponsive. Hard to fix afterward, not all that hard to do right if you keep it in mind.

请记住SwingWorker,或在单独的工作线程中处理事件。我无论如何都不是Swing的专家,但我知道Java Desktop应用程序的许多感知缓慢是由于在事件线程中完成的工作。如果这样的工作需要一些时间,整个GUI都没有响应。之后很难修复,如果你牢记这一点,那就不是很难做到的。

As for books, I found the Core Java series by Cay Horstmann and Gary Cornell very nice to read. It is however about Java (including Swing) and not about MVC.

至于书籍,我发现Cay Horstmann和Gary Cornell的Core Java系列非常好读。然而,它是关于Java(包括Swing)而不是关于MVC。

#6


0  

I need to add to my above entry that the free BOOK -- THINKING IN JAVA talks about OOP, MVC and also about Swing. Not sure if it discusses the various implementations of MVC, though.

我需要在上面的条目中添加JAVA中的免费BOOK - THINKING谈论OOP,MVC以及Swing。但不确定它是否讨论了MVC的各种实现。

#1


8  

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.

我遇到了同样的问题:编写一个(非平凡的)swing应用程序确实需要很多纪律,因为所有的侦听器和事件以及异步处理对于大量不可维护的代码来说非常快。

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是不够的,你必须研究更具体的模式,如Presentation Model等。当我应用于桌面应用程序时,我发现的唯一涵盖此模式的书是Scott Delap的Desktop Java Live。虽然大多数摇摆书都涉及解决特定问题的技巧(如何制作无格式jtable,如何实现圆形按钮,......),Delap的书将帮助您构建中型摇摆应用程序,最佳实践等。

#2


2  

Pretty much any java, eclipse, netbeans swing books should to the trick.

几乎任何java,eclipse,netbeans摇摆书都应该成功。

1) FREE --- Thinking in Java (http://mindview.net/Books/TIJ/DownloadSites)
2) CORE java , vol 1 and 2
3) Swing hacks : http://www.amazon.com/Swing-Hacks-Tips-Tools-Killer/dp/0596009070
4) netbeans RCP : http://www.amazon.com/Rich-Client-Programming-Plugging-NetBeans/dp/B00132S6UU/ref=dp_kinw_strp_1 5) eclipse Rich client programming -- http://www.amazon.com/Eclipse-Rich-Client-Platform-Applications/dp/0321334612

1)*---用Java思考(http://mindview.net/Books/TIJ/DownloadSites)2)CORE java,第1卷和第2卷3)Swing hacks:http://www.amazon.com/Swing- Hacks-Tips-Tools-Killer / dp / 0596009070 4)netbeans RCP:http://www.amazon.com/Rich-Client-Programming-Plugging-NetBeans/dp/B00132S6UU/ref=dp_kinw_strp_1 5)eclipse富客户端编程 - - http://www.amazon.com/Eclipse-Rich-Client-Platform-Applications/dp/0321334612

Hope this helps.

希望这可以帮助。

BR,
~A

#3


2  

In C# rather then Java, but Jeremy Miller has a bunch of posts regarding desktop apps and MVP/MVC (and a whole bunch of other related stuff).

在C#而不是Java中,但是Jeremy Miller有很多关于桌面应用程序和MVP / MVC(以及其他一些相关内容)的帖子。

#4


1  

Just to throw in my 2 cents, I recommend the book Head First Design Patterns. It has a very good explanation of the MVC pattern (in Java). It builds on other design patterns also discussed in the book such as Observer, Strategy and Composite that are used in MVC.

只要投入2美分,我就推荐Head First Design Patterns这本书。它对MVC模式有很好的解释(在Java中)。它建立在本书中讨论的其他设计模式的基础上,如MVC中使用的Observer,Strategy和Composite。

Best MVC tutorial I've read. Highly recommended.

我读过的最好的MVC教程。强烈推荐。

#5


0  

Don't forget the Swing Tutorials; for instance the Swing Events tutorial.

不要忘记Swing教程;例如Swing Events教程。

And please bear in mind the SwingWorker, or handling events in a separate worker thread. I'm no expert on Swing by any means but I do know that a lot of the perceived slowness of Java Desktop applications is due to the work done in the event thread. If such work takes some time the entire GUI is unresponsive. Hard to fix afterward, not all that hard to do right if you keep it in mind.

请记住SwingWorker,或在单独的工作线程中处理事件。我无论如何都不是Swing的专家,但我知道Java Desktop应用程序的许多感知缓慢是由于在事件线程中完成的工作。如果这样的工作需要一些时间,整个GUI都没有响应。之后很难修复,如果你牢记这一点,那就不是很难做到的。

As for books, I found the Core Java series by Cay Horstmann and Gary Cornell very nice to read. It is however about Java (including Swing) and not about MVC.

至于书籍,我发现Cay Horstmann和Gary Cornell的Core Java系列非常好读。然而,它是关于Java(包括Swing)而不是关于MVC。

#6


0  

I need to add to my above entry that the free BOOK -- THINKING IN JAVA talks about OOP, MVC and also about Swing. Not sure if it discusses the various implementations of MVC, though.

我需要在上面的条目中添加JAVA中的免费BOOK - THINKING谈论OOP,MVC以及Swing。但不确定它是否讨论了MVC的各种实现。