Programming language decision for C++ legacy project workflow [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I have quite a lot of C++ legacy code modules from my colleagues, unfortunately poorly written. Each is doing a different job, but they are all GNU C++ code running under Linux.
I want to write a controller program, to make a singular C++ module for a workflow, for a very urgent demo. Also I need to write a front-end web-app allowing clients submitting jobs to the controller.
My main criteria are:
development speed (very urgent demo)
good binding with C++ (I have legacy code I do not want to rewrite in another language)
smooth introduction of new programming language to team (has some python, java and perl knowledge)
What programming language fits my needs best, and why?
Details:
I lean towards python for its perfect binding with C++, as writing JNI is too much work, and kind of obsolete nowadays. However, no one in my team is Python programmer; I do know some Python (no experience in server side programming at all). I have been developing Java EE apps last year, but I do not think JNI is a good solution. Only one team member knows some Perl, others are pure C++ programmers.

Noting the "very urgent demo" part, assuming that that would take about a month, depending on the complexity, I'd stick to the familiar.
True, maintaining python would be easier in the end, and learning python should be a breeze, if you deem it viable.
I'd say, have the team learn python and do the basic stuff, as you learn the deeper parts, you could build classes for them to extend/implement. That way, you get things done as they learn.

Given the urgency, I'd have to stick with C++.
Without that, I'd say keep what you got, but feel free to switch to a preferred language when refactoring. That would be the time to do it.
What you should not do, ever, is "port" anything to another language without rewriting or changing functionality in any way. It is a total waste of time, when the "best" outcome you can hope for is that it has no new bugs when you are done.

I would use Python. You could write very basic wrappers using the Python C API and then call said functions from Python with relative ease.

Related

Convert prolog application to a JVM based language? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a legacy ISO prolog application of medium size that I would like to move to a JVM based language. The application is a command line tool that parses text files, does some evaluation/transformations and then export a text based file.
My team develops mainly in Java so we have a lot of existing java competence and reusable components. Prolog competence is however very low.
I don't expect there to be a tool that takes prolog source code and transform it to some other language. But I'm trying to understand what would be the easiest solution. Starting from scratch in Java or using a more functional language like Clojure?
But I'm trying to understand what would be the easiest solution.
Some implementations of Prolog run on the JVM platform. Wikipedia lists 5 of them here: http://en.wikipedia.org/wiki/Comparison_of_Prolog_implementations. So maybe the easiest solution is train someone in your team in Prolog, and just port the application to a JVM Prolog implementation. (Which might be a simple thing ...)
Someone on your team is likely to need Prolog skills anyway to successfully translate Prolog to some other language.
However, I recognize that there could be other reasons to translate; e.g. if the existing Prolog code needs a major overhaul anyway.
That is mainly depending on your team's skill. You mentioned that your team has a pretty good Java skills; why not starting with that?
If they don't know LISP, they will spent a lot of time learning it from the scratch. Learning LISP is quite an investment but it is definitely pays in the end.
Although Clojure is going to help you a lot in your case (because of data flow and data transformation), I would say that Java is a better bet since your team is competent with it.
You could consider using Clojure together with core.logic (tutorial) which is a miniKanren implementation. You would need some logic/functional programming skills but you could stay on the JVM.
Prolog is so different from java and other Object Oriented Language. I studied this language to see an other way of programming.
But I dont think there is a magic solution to convert prolog app to a java app. The logic is not the same and no other language is like Prolog. I think you will have to analyse what your prolog app does exactly and go from scractch with a new java app.

Limitations (drawbacks) of java programming language? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am a beginner in java programming language, I have recently studied basic concepts of java programming language. I just want to know, What are the limitations of Java programming language in terms of memory management and other run time related issues.
Thanks in advance.
Java is OO programming language. Within that realm, considering static typing, there aren't much limitations. Java works well. At present JVM does not do tail call optimization, which can be considered a limitation. But that is limitation of the JVM, not the language. With Java 8 there are closures, and anonymous functions. The syntax is a bit ugly, but it's kind of ok. So we can't complain there. However, when comparing to functional languages (thinking Haskell), I miss array comprehensions, lazy evaluation the most.
The way in which Java approaches concurrency is using threads with shared data. We know that shared data can make parallel programming difficult. If Java has build in mechanisms for message passing like ZMQ or green threads (like Kilim) with no shared data, it would be cooler. But earlier on during the design phase they choose green threads, but later on moved to native ones for performance gains. Concurrency using STM (Software Transactional Memory) would be make great addition to java.utils.concurrent library. These aren't limitations per se, they can be added at a later point in time, using JSRs. But at present we do not have such mechanism.

How to use more than one language for a project? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
We see that certain huge projects are written in more than one language
For example facebook is written in php and c++, and android operating system is written in c,c++ and java.
In the following links on the right side more than one languages are written in front of "written in"
Android=http://en.wikipedia.org/wiki/Android_(operating_system)
Facebook=http://en.wikipedia.org/wiki/Facebook
Are there any compilers for doing this?
Sometimes (Facebook) you have a system of many different interacting programs, each of which can be written in a different language, and even be running on different machines. I am sure that a complex website like Facebook involves many pieces written in many different mainstream and homespun "languages".
Other times (Android) you have a single entity in which pieces written in different languages are combined. I'm over simplifying a bit, but if you think about it, compilers ultimately compile down to machine code, and a linker can simply combine the pieces.
In reality, it's often more complex, and many languages are interpreted rather than compiled. To combine languages that have complex runtime systems like Java, Python, Ruby, etc into one program, there will be specific, point-to-point solutions for each case. For example, the Java Native Interface (JNI) is a standard mechanism for embedding Java into C and C++ programs.

How do you integrate functional programming languages to Java or C#? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am interested in using OCaml or Haskell to develop an engine for statistical computing. This functionality is supposed to work on data that is going to be provided by a model driven, Object Oriented information system. The whole thing needs to scale up and out.
I can see a lot of benefits in using Haskell for example, but getting the data in an out of the Haskell code is tricky. There are always out of the box options like C/C++ interfaces or JNI, but in an architecture which is supposed to scale, I find these approaches problematic and error prone.
Considering FP is on the rise, how do people integrate these languages into widely used languages, hence technologies such as Java? I have been using ZeroMQ and Protocol Buffers for Eiffel to Java integration for example, but are there any options which has proven to be stable and high performance?
Ps: Stackoverflow warns me that this question appears subjective, but I am asking about actual technical solutions to connect different runtimes. I have no intention of discussing pros/cons of any language or paradigm.
Have you considered using Scala? It supports functional programming on a JVM platform. You could integrate it with Java, but you might find that is not needed.
You may also find it is faster than Haskell, esp. with tighter integration with Java.
http://benchmarksgame.alioth.debian.org/u64q/which-programs-are-fastest.html
F# will give you functional programming with the .Net platform for "free".
OcamlJava can interface Java with Ocaml:
OCaml-Java is an effort to make Objective Caml available on the Java platform, currently supporting 3.11.2. The project has two concrete objectives: first, the ability to run Objective Caml sources that have been compiled using ocamlc; second, the ability to compile Objective Caml sources into executable jar files.
You use languages such as Scala, i.e. languages that already run on the JVM.
There are plenty functional languages that run on the JVM and thus integrate quite nicely with the rest of the java code.
My favorite is Scala, but there is also Clojure and Groovy, just to mention a few.
Using Scala or F# would be the real solutions as others say, but just in case if you like something easier to start with, you can also do some functional programming in Java (or C#) like these people https://www.google.com/search?q=functional+programming+java as FP is a programming style that favors immutability.

Switching from .NET to Java? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
For the past few years, I've been working on a team that does .NET and SQL Server. I'll soon be joining a team that is Java and Oracle. What can I read/do to get up-to-speed.
Start here: http://java.sun.com/javase/6/docs/
Sun's documentation is pretty good.
See also:
Hidden Features of Java
Best Java Book you have Read So Far
Overriding Equals and Hashcode in Java
What is the Most Freequent Concurrency Problem You've Encountered in Java
Javapassion is a site that offers free courses on Java. If you are on a hurry, there are 1 to 5 days courses available. You should have no problem following it, if you have experience in Java.
There are many good books for Java, but Thinking in Java is free and is good both for getting started and using as a reference.
If you need conversion of things from one language to the other here is a great website:
http://www.25hoursaday.com/CsharpVsJava.html
This, similar, SO Thread might be helpful.
Josh Bloch's Effective Java is a fantastic book. If you want to learn modern Java idioms there are few better places to look at.
Be prepared to do a lot of reading. C# (assuming this was the language you have been using)is generally regarded as an improved Java, so the Java basics will not be hard to grasp. Java development tools are generally not as tightly integrated as the Microsoft stack, thus allowing for choices to be made. Lots of discussions in Javaland revolve around choosing tools.
Get to know something about the way Java packages things (jar, war, ear).
Learn about the classpath (an endless source of joy and grief).
Build a mental picture of how things work at compile time and run time (generics and type erasure, for instance).
Visit the JavaRanch (http://www.javaranch.com/) and test your Java knowledge with the Rules Roundup! Think of it as a certification mock exam, but with cows. ("No cows were harmed in the making of Rules Roundup.")

Categories