当然,在您的代码中随处使用GUI库会将您的代码绑定到相关的库中,但无论是更好还是 比替代方案更糟糕的是根本不清楚。在某些情况下,聪明的 设计可以允许在代码和 库之间进行干净的抽象,但这并不容易。My personal experience on using GUI libraries is that you should,obviously, separate what all the functionalities of the program whichyou can into their own portable modules (this is rather obvious for thesimple reason that it''s good OOD), but trying to abstract away thenon-standard GUI library completely from your program is usually moretrouble than it''s worth.I once tried this, and the results were less than satisfactory. Myintention was to make a clean abstraction of the underlying GUI library,ie. hide everything in it inside its own module in a way that wouldallow me to change the underlying GUI library easily to something else(eg. from gtk to wxwidgets or to qt or to native Windows API or whatever).While this sounds like a great idea in theory (and it still is), inpractice the whole system became awkward, limited and hard to maintainand expand. At one point I simply noticed that I was basicallyreplicating the underlying GUI public interface in my own "abstract"module. While I got something working, in the end I was not verysatisfied with the result. (And, rather ironically, the underlying GUIlibrary was never changed to anything else, so all that abstractingbasically went to waste.)Sure, liberally using the GUI library everywhere in your code will tieyour code to that library in question, but whether that''s better orworse than the alternative is not clear at all. In some cases a cleverdesign could allow a clean abstraction between your code and thelibrary, but it''s not easy. 我确定我不是唯一面对这个问题的初学者和大多数书籍 处理语言的技术细节好吧,但是不要给任何信息,比如 这个。 可能这个信息会出现在我想的其他更一般的编程书中吗? 我注意到了用C ++进行大规模程序这本书或来自Addison的东西 Wesley。我会寻找一个评论。也许这只是我需要的这本书 这样的问题。 无论如何,非常感谢。它让我有所思考。I''m sure I''m not the only beginner facing this question and the most bookshandle the technicalities of the language well but don''t give any info likethis.Probably this info will be in other more general progamming books I suppose?I noticed the book ''Large scale programs with C++'' or something from AddisonWesley. I will look for a review. Maybe this is just the book I need forquestions like this.Anyway, thanks a lot. It gives me something to think about. 这篇关于设计较低级别的课程。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!