Convert prolog application to a JVM based language? [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 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.

Related

Learn Spring Boot based on Kotlin or Java? [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 1 year ago.
Improve this question
Background:
Around next year I will finish university and wanna learn some skills that help me in the industry. For that, I choose to learn Spring Boot, cause I currently like the JVM environment and already have "ok´ish" knowledge in Java and Servelt/Tomcat. In addition, I got some basics in kotlin through app development, so I know that I like both Java and Kotlin.
Question:
If I got it right, Kotlin is the first class citizen in Spring Boot now, but the industry is really slow in adapting new technologies.
So if I learn Spring in Kotlin,
can I easily switch to Java Spring?
do companies care?
do I miss out on other, more important skills that I can learn instead?
Thanks in advance for every input :)
Gretings Pascal
So if I learn Spring in Kotlin,
You will learn Spring, using Kotlin. Spring is a JVM framework, the API you will interact with is the same in Java or Kotlin.
can I easily switch to Java Spring?
You can even mix Kotlin and Java in the same project and it will work, however I do not advise doing so. It's also possible to translate from Java -> Kotlin (IntelliJ does this if you paste java code in a .kt file!) or Kotlin -> Java, however the output code is not very nice :)
do companies care?
You should ask this to your superiors, it depends a lot on the company policies. In general, Java has a much bigger market specially for big companies which move slow and are afraid of changes. Kotlin is mostly sought for Android development, on which Spring is not recommended.
Nevertheless, if you already know Java and just are interesting only in learning Spring I suggest you use Java for this.
do I miss out on other, more important skills that I can learn
instead?
I'm also a Java and Kotlin programmer for the backend and I can say that the Kotlin opportunities are mostly for Android development, it's odd to find roles for Kotlin backend development.
If you're looking to prepare for your first job I'd say don't worry on learning a new language, Java has a lot of opportunities. I suggest you focus instead on learning the other important aspects of development (databases, cloud services, containers, testing, software engineering, networking, etc.) those will be far more valuable than knowing two very similar programming languages.

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.

Python's NLTK vs. related Java Libraries? [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 6 years ago.
Improve this question
I've used LingPipe, Stanford's NER, RiTa and various sentence similarity libraries for my previous Java projects that focused on text (pre)processing (indexing, xml tagging, topic detection, etc.) of large amounts of English text (around 10,000 documents summing to > 1gb of text). Maybe I'm a bad Java programmer, but I find myself typing a lot of code and using a lot of libraries when I switch to a different corpus. Overall, I feel like there might be a better tool for the job.
I guess my question is, will I benefit from switching to Python and NLTK for information retrieval / language processing? Or are there enough pros and cons to make it very subjective? Is NLTK intuitive enough to be learned quickly?
I'd get my hands dirty, but I won't have access to a personal machine for the next few days.
NLTK is good for natural language processing. I've used it for my data-mining project. You can train your own analyzer. The learning curve is not steep.
NLTK got huge corpus for training of your analyzer. You can also provide your own set of data, for example, a journal which a part-of-speech tagged.
Because python is very good for text processing, you may to give it a try. Plus, it got a online tutorial
Please don't forget to use python 2.x version. Try python 2.6.
NLTK may not be good with python 3.x
If you already understand the basics of NLP, I think NLTK should be pretty easy to pick up. It's got a bunch of documentation, 2 books, and I've written a number of articles & tutorials on streamhacker.com. And if there's anything from the Java packages you don't want to lose, you could theoretically combine it with NLTK using Jython (and perhaps execnet).
You also may want to take a look at the Pattern library.

Programming language decision for C++ legacy project workflow [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 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.

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