views:

210

answers:

8

I have to write a prototype app for an engineering company. Most of the work is calculating various engineering properties (I'm talking pipes and real things here, not software engineering).

However, there will also have to be a GUI for:

  • parameter entry
  • displaying results
  • some basic diagramming

  • The calculation work at the moment doesn't involve complex math elements (no matrices at the moment), just logs, square roots, relatively simple formulae. Later I will have to do some:

  • curve fitting
  • numerical approximation

  • I was wondering if Java has been used for real world engineering apps?

    Are there libraries available for this sort of thing?

    Or am I better off writing in MatLab and then connecting to the code through Java?

    Also open to other languages (although we are a Java shop).

    +4  A: 

    Python has several decent GUI toolkits as well as NumPy, and is easy and fun to write in.

    Ignacio Vazquez-Abrams
    If he works in a Java shop, I would not use a python library, even though this may be more fun. The GUI does not seem the main problem of the project, you can draw on any panel of any Gui framework.
    bertolami
    That would be why I mentioned NumPy. It's like MatLab, but without MatLab.
    Ignacio Vazquez-Abrams
    You could use Jython if you need to interface with Java. I don't know whether there are any problems using Jython with SciPy, but there are problems using Iron Python with SciPy: you need IronClad to call functions internally implemented in C.
    John D. Cook
    +4  A: 

    I guess that Java would be a good choice, even though it is not considered a typical language for rapid application development.

    Pros:

    • versatile GUI toolkit for desktop applications in standard library (Swing),
    • (relatively) cross-platform,
    • great libraries, e.g. from the apache project; a great math library to look at would be colt; for charts and diagrams, you may like jfreechart ..

    Cons:

    • "not so rapid" prototyping capabilities

    Further reading:

    The MYYN
    A: 

    You may also want to consider R language.

    kgiannakakis
    R is intended more for statistics.
    duffymo
    +4  A: 

    I have done some work where I had to reimplement Matlab code in Java so it is certainly possible. The Java code can end up being quite verbose compared to the Matlab original due to Matlab being able to operate directly on matrices/arrays etc.

    Some math libraries that you might want to look at to see if they support the functionality you are looking for:

    Mark
    +5  A: 

    This sounds like a job for Matlab: you don't give any reason not to use it. There's some code for evaluating Matlab expressions from Java: http://www.cs.virginia.edu/~whitehouse/matlab/JavaMatlab.html

    Charles Stewart
    +1  A: 

    This depends mainly on how easy it will be in your environment to include the mathlab or other math engine in your product. If this is easy, I would suggest to use mathlab, but if not, e.g. you have licensing issues or deployment issues, you are probably better of just using plain Java code.

    bertolami
    +12  A: 

    Hi

    I have some experience of both Matlab and of Java for scientific/engineering type codes. Yes, Java is used for real-world scientific and engineering codes, and yes there are libraries available. You can certainly do what you want using either so I'm not sure that you could sensibly distinguish between the two on the sole basis of your current requirements. I'd ask myself the following questions:

    1. How good am I at programming advanced mathematical operations ? Operations such as function minimisation, differential equation solvers, matrix algebra. If the answer is not very then lean towards Matlab which will provide all of these out-of-the-box (though you may need additional toolboxes). If you opt for Java, make sure you are very comfortable with floating-point arithmetic and dealing with the sorts of errors which occur when you use it.
    2. Do I want to code everything in Java, everything in Matlab, or am I happy to use both and to wrestle with, say, a Java GUI on a Matlab engine ? I think you can do much better (in a vague sense) GUIs with Java than with Matlab, but Matlab's GUI facilities are good enough for most of its users that the added complexity of integrating Matlab with Java is not worth tackling. But then many Matlab users are not software engineers.
    3. What speed of development do I need for the prototype work ? If you were equally skilled in Java and in Matlab then I'd guess that you could do it quicker in Matlab, because the numeric stuff is already provided, you could concentrate on the GUI. But if you are a skilled Java programmer coming newly to Matlab you might decide to stick with what you know.
    4. How will I develop and deploy the production app if the prototype is successful ? If Matlab doesn't fit your deployment ideas then learning it and forgetting it may not be rewarding.

    Finally, since you solicit other language recommendations: forget Java, forget Matlab, forget Python, forget R, use Mathematica, it's way more fun and very powerful.

    Regards

    Mark

    High Performance Mark
    +1 for complete thought process behind the recommendation.
    Kena
    A: 

    I would do a search for software that's written to do piping calculations. This problem has been done. (As you've noted, the calculations need not be difficult.) At a minimum I'd recommend that you know what's available to you, how much it would cost, and where the break even point was for development costs.

    A commercial product will have one huge advantage over anything you'll write: It will have a larger user community that's been banging on it and finding bugs for a longer period of time than your prototype. That's worth something as well.

    What's your opportunity cost? What else could you have done with the development time that would drive more revenue?

    duffymo