Recommended books on Desktop Application developme

2019-02-01 14:45发布

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

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.

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.

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

6条回答
一纸荒年 Trace。
2楼-- · 2019-02-01 14:49

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.

查看更多
爷、活的狠高调
3楼-- · 2019-02-01 15:05

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

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.

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.

查看更多
萌系小妹纸
4楼-- · 2019-02-01 15:10

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.

Best MVC tutorial I've read. Highly recommended.

查看更多
聊天终结者
5楼-- · 2019-02-01 15:11

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

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

Hope this helps.

BR,
~A

查看更多
再贱就再见
6楼-- · 2019-02-01 15:14

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).

查看更多
祖国的老花朵
7楼-- · 2019-02-01 15:15

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.

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.

查看更多
登录 后发表回答