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.
Related
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 don't know much about concurrency in Java such as Fork/Join Framework, Locks, Threads(comprehensively), Executors etc.
I just have little basic knowledge & theoretical about it.
Since Clojure runs on JVM, I thought that I must know Java's concurrency model really well before jump into Clojure(concurrency)?
I write Java but never needed concurrency at work.
Now I write Clojure and want to do some concurrency/parallelism stuff with it.
Should I know Java's Concurrency model or Can I learn while practicing with Clojure?
No, you don't nead to learn such things to use Clojure's concurrency and parallelism features.
I'm never going to advocate not learning something, though in this case if you are learning these things at the same time you may be tempted to reach for locks in Clojure, which is almost always unnecessary, rather then doing it the idiomatic Clojure way.
What you certainly do need to learn is the fundamental ideas of concurrent programming and parallel programming. Things like how to intelligently split work, and how to combine the results so you get correct answers.
Also how to avoid crating so many threads that you cause resource starvation. These things can be learned in (almost) any language, though learning them in Clojure is more fun than some others.
One possible danger is that when working without the Clojure features you may find less satisfaction when going back to the more traditional OO approach in Java.
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 7 years ago.
Improve this question
I have a question:
I'm rying to make web services for Android but I don't know which language (PHP or Java) I should write on according to the ability of scaling the website for different devices.
One of the primary structural differences between PHP and Java is the
difference between strongly- and weakly-typed languages. Java is a
strongly-typed language, meaning it requires explicit statements of
intent to function and that it is backed by a compiler. At the highest
level, you can think of this as meaning it has strict expectations on
how you express inputs and outputs. If these exact expectations are
not met, the compiler will fail and the program will not work until
errors are resolved.
PHP, in contrast, is weakly typed, essentially meaning it is more
flexible and reliant on “common sense programming” in how a task is
accomplished. While this may sound more attractive because it
requires less formal knowledge, some contend that it complicates
certain tasks, particularly in object oriented programming, with its
lack of standards.
Choose according to your needs
Everything depends on what you want to do on this website.
But here is a Link of a blog that discusses which is better:
PHP vs 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 8 years ago.
Improve this question
I have a task to extend an implementation of an ongoing project written in C that is already working well, so that it will be multi-threaded.
I have many years of experience with Java, but very limited for C. So basically I have some options like the following:
Rewrite all of the code to Java and later implement multi-threading in Java
Implement multi-threading in Java by calling some methods from C library through JNI
Learn C and continue the task in C.
By considering that the multi-threaded version does not have to get the latest update from the C library, and probably later I might need to put these code in some big data framework like Hadoop.
In order to find out which option could be better for me, I would need comments about the following questions based on what you have already experienced before.
How smooth it will be to call a C function from Java and if there is any significant limitation?
What are the pro and cons of implementing multi-threading in C?
And also which option that you think is better?
I would go on 3. Multithreading relies on few basic concepts of mutex and semaphores, both in the POSIX standard, and I would recommend you learning them. The C concepts are really basic, the most difficult thing you have to learn will probably be pointers so nothing hard. Having coded multithread projects both in Java and in C I would recommend C (having an hard Java background it's difficult to say for me! ) to learn an important part of POSIX standard (used in Unix too), not to depend on extern libraries and virtual machines. If you want to do it in Java, I would exclude solution 2 and make a standalone Java project, it has appropriate libraries to support multithreading.
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.
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.