Java,GUI构建器还是手工编码? [英] Java, GUI builder or hand coding?

查看:162
本文介绍了Java,GUI构建器还是手工编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司软件有很多形式,直到现在我们手工编写代码(MVC方式)。



我们正在考虑开始使用GUI构建器。 / p>

使用Builder的问题很少。


  1. 部分代码是不
    可读即可。

  2. 的代码的某些部分没有
    编辑即可。

  3. 将变得更加困难后编辑代码

  4. 我们将不得不继续使用
    建设者在未来,
    即使我们想更换生成器或手工编写,也没有人能保证该工具将来可用并支持。

我想向别人学习经验:


  • 您是否推荐使用工具或者应该继续用手写代码?

  • 哪个构建器更好?

  • 他如何处理这些问题? (有没有其他问题?)


解决方案

有关我建议使用短短形式生成器。它会更快地完成任务。但是,如果您有很多表单需要维护一段时间,我建议不要使用构建器。在这种情况下,您花在阅读代码和维护上的时间要比初始设计时间大得多。所以,当构建器在初始阶段为您节省一些时间时,它会使代码的读取和维护变得更加困难。更重要的是,它使代码重用,即使以复制和粘贴的形式从一种表单复制到另一种表单,也更加困难。



我不知道你是否指的是Web或桌面应用程序,但通常我还没有找到能够产生优雅输出的Java Gui构建器。例如Netbeans Swing生成的代码是一团糟。也许,如果一个漂亮的建筑师可用,我会改变主意。我使用Visual Studio的窗体设计器没有问题 - 它产生好的代码,您可以阅读和理解



有关桌面应用程序看看的 MiGLayout 。它是Swing和SWT的布局管理器,而不是构建器,它会让你的生活更轻松。


My company software has a lot of forms, till now we wrote the code by hand (MVC way).

We are considering to start using GUI builder.

There are few problems with using a Builder.

  1. Parts of the code are not readable.
  2. Parts of the code are not editable.
  3. It will be harder to edit the code later.
  4. We will have to continue using the builder in the future, even if we want to replace builder or write by hand, and no one can assure that the tool will be available and supported in the future.

I want to learn from others experience:

  • Do you recommend using tool or should we continue write code by hand?
  • Which builder is better?
  • How does he deal with the problems? (Is there any other problems?)

解决方案

For just a few forms I recommend using a Builder. It will get the done way faster. However, if you have a lot of forms that you need to maintain for some time, I recommend against a builder. For this case the time you spend in reading the code and maintenance is much larger than the initial design time. So, while the builder saves you some time at the initial phase, it makes code reading and maintenance more difficult. More over, it makes code re-use, even in the form of copy and paste from one form to another, more difficult.

I don't know if you are referring to web or desktop applications, but in general I haven't found a Java Gui builder that produces elegant output. Netbeans Swing generated code for example is a mess. Perhaps, if a nice builder were available I would change my mind. I had no problem using Visual Studio's form designer - it produces nice code that you can read and understand.

For desktop applications have a look at MiGLayout. It's a layout manager, not a builder, for Swing and SWT that will make your life easier.

这篇关于Java,GUI构建器还是手工编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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