[ art / civ / cult / cyb / diy / drg / feels / layer / lit / λ / q / r / sci / sec / tech / w / zzz ] archive provided by lainchan.jp

lainchan archive - /λ/ - 19026

File: 1475436250268-0.png (68.05 KB, 300x211, tux-Java-t2.gif)


I don't know much about Java so I'd like to know a bit more about it.
Is it a memory-efficient language?
Does it have analogs? Widespread analogs?
Is it used in embedded solutions?


>Is it a memory-efficient language?
Short answer is no. This is a common complaint and you can read more about it here: http://www.ibm.com/developerworks/java/library/j-codetoheap/index.html
I have a question of my own, what am I giving up when I use Java's way of taking string input as opposed to C++ and Objective-C? Because Java sure as hell is easier to handle. As I understand it I'm giving up memory but at what scale would that begin to matter?


Please clarify what exactly you mean by:

>Java's way of taking string input

>C++'s way of taking string input
>Objective-C's way of taking string input


On a low level a string in Java is still just a reference to an array of char's. It is not particularly more expensive since they are immutable and therefore can be stored in a fixed amount of memory. They are stored on the heap though so there is some more overhead.

C++ on the other hand is an array of chars and can be manipulated as you please. So a string operation in C++ can be done in place and consume less memory, where Java would need to make a new string and have the old one garbage collected.
This doesn't really matter, even in the large scale since the garbage collector is very good at this sort of stuff, and the amount of extra RAM and CPU used is negligible.

>Is it a memory-efficient language?
No it is not memory efficient, since it needs to run an instance of the Java Virtual Machine
>Does it have analogs? Widespread analogs?
The most similar language to Java is C# if that is what you mean by analogs
>Is it used in embedded solutions?
It can be used for embedded systems, but it doesn't seem to be as popular as other options.


>It can be used for embedded systems, but it doesn't seem to be as popular as other options.
In some embedded domains, such as SIM cards, Java (well, a subset of it) is still the only option.


I’m still in the process of learning, so I’ll give my two cents.

I don't know the context of what you mean by "analog" or "widespread analog", and from my humble perspective Java can be engineered as a general memory efficient, in the sense that it has its own form of garbage collection and you do not have to allocate memory for your objects on your own. Here's a good explanation of it: http://stackoverflow.com/questions/755878/any-hard-data-on-gc-vs-explicit-memory-management-performance

I'll assert that Java memory management is not any less efficient than C++, C languages, Haskell or any other native languages. However, memory management for smaller applications. Memory management is better in native languages for smaller applications only when you have less memory (< 2gb or so). If you have equally memory on a typically sized machine from today, the Java memory management model is no less efficient than the C++ or C way of management memory manually.

Yes, Java is used in embedded solutions. A quick example being Intel having a mini-VM of Java running in its CPUs to help with DRM protection when running Blu-Ray movies and other protected content. Java is also used in many other types of micro-processing boards as well, sometimes in a Linux VM that runs Java or just on its own.


>SIM cards

What sort of stuff can you make such a card do?


Surprisingly more than what you might think. They're designed to securely store data, so that instead of reading your network authentication information and potentially compromising it, you may only make requests and get enough information to initiate a call or send a message, without ever exposing your authentication info.
They can be used for more than that, though. Everybody knows they can store contact information, for one. You might also remember having an app with your carrier's name on it, or something among the lines of "SIM services" that offered things like horoscope or TV shows schedules on your old phones: these were all programs that ran on the SIM card.
If you're interested, this talk goes more into depth.


>Is it a memory-efficient language?
If you take whole java virtual machine out of the question it's preety efficient.

>Does it have analogs? Widespread analogs?

What do you mean by analogs?

>Is it used in embedded solutions?

Hell yeah, tons of POS devices and ATMs use Java. Not to mention things like DVRs,
security cameras, smart TVs, I could go on for forever.. you get the point.


If you want to understand Java, understand the JVM. How much stupid soykaf a coder jokes about Java I find to be a metric for how cocky and new they are to this field. The role Java has in the marketplace is getting out gunned by the .NET ecosystem and though most Java jobs probably suck because most programmers suck, work in distributed systems in areas such as finance or data processing to be the coolest areas of note for the lang (see also Clojure).

* the JVM and Java are standardized EXTREMELY WELL, in my experience the best in fact; code (with GUI functions! and I/O!) I wrote in 2010 worked identically on a machine from 1999 and 2016, and because the JVM pops up on just about every PC made since the 90s, installation or setup is usually not required: I challenge you to find /any/ other platform or language where this is also the case
* JVM threads and tooling are great, open something like the JVMTI and inspect what an entire JVM instance is doing
* if you can master Java and go on to learn Clojure you'll have opportunities to work with some of best applications programmers and the cleanest codebases around: somewhere I read that Clojure developers are the happiest in their industry for this reason

>Is it a memory-efficient language?

>Short answer is no

the short answer is that this poster seems to be internet educated rather than industry educated

Java is simply a language, the JVM simply a VM, high-speed financial trading platforms or other distributed systems regularly tune or modify their various version of the JVM for memory efficiency and speed /just like any other piece of software/

because of my domain of work I use assembly or some form of lisp but if someone gave me a month with no budget to deploy a distributed system that needed to run on as many computers as possible it would probably be a JVM application


>The role Java has in the marketplace is getting out gunned by the .NET ecosystem
Really? I thought .NET is tied to Windows.


.NET is getting around nowadays, thanks to Mono, a long running free software implementation, and .NET Core, Microsoft's own open source effort.


Is .NET any better compared to Java if it is getting around?


It's not owned by Oracle.


what field are you in?


A reduced version of Java is used to program Apps for SIM cards.
additional FINNformation: https://www.youtube.com/watch?v=31D94QOo2gY


But it's owned by Microsoft
However F# is probably better than java


You can compile OCaml for the JVM.


I'm writing an utility in Java. The program will be able to print QRcoded data on paper and scan them back in using commodity hardware like multifunctional printers.

My primary use case for this program is keeping my GPG master key offline. For this, I need durable data storage and most devices are unreliable, especially flash drives. Online research revealed that paper is an appropriate medium despite not being as dense.


I'm using Google's ZXing library to handle the 2D barcodes. After it is functional, I suppose I'll have to test the system. I'm still not sure how. I suppose I could automate an data → encode → print → scan → decode → data cycle somehow. I should also test error correction capabilities...


Is there any good books or something on using the new features and APIs in Java 8?


>Is it a memory-efficient language?
No, but I don't think that was the point of it either.


File: 1479489190833.png (358.69 KB, 200x150, two-states.png)

One thing that pretty much everybody who has used Java can agree on (assuming they have some frame of reference beyond Java) is that it's the definition of a nanny language. For as high-level of a language as it is, it's incredibly verbose, and deliberately withholds from the user a good deal of common-nicety syntactic sugar. It requires you to be painfully specific as to what you want the machine to do.

This is because it was designed for big companies to use to keep novice coders in line. All of its qualities obnoxious to programmers make it wonderful for bosses. It is a language specifically designed for use by code monkey keyboard slaves.

If you want to learn it, learn it because you intend to use it at a job. If you're just interested in pet projects and learning about computer science on your own, there are a thousand better options for you.

On top of that, it's an exclusively object-oriented language, which means that while it does make complex programs simpler, it also makes simple programs more complex. C++ is object-oriented, but you don't have to use any of its object-oriented functionality if that's not necessary.


>This is because it was designed for big companies to use to keep novice coders in line. All of its qualities obnoxious to programmers make it wonderful for bosses. It is a language specifically designed for use by code monkey keyboard slaves.
THE fuarrrkING TRUTH. java is the corporate language of the slaves and run of the mill brogrammers.


>It is not particularly more expensive since they are immutable and therefore can be stored in a fixed amount of memory

just for giggles, the old implementation (changed pretty recently) was quite retarded, if you substringed a huge string, then the original huge char buffer would be kept around in RAM


I hate Java with a burning passion, for the reasons described in >>20259. It's more verbose than C, less pleasant to write, unpleasantly hand-holdey, and all to many of its programmers usea sort of cargo-cult-OO, which is bad, but by Kay's definition, Java isn't even really that object-oriented.

Java also popularized IDEs, and for good reason: It's very difficult to write all but the smallest Java projects without one, particularly without the refactoring tools they provide: if your language is like kicking dead whales down the beach so much that people *need* external tools to even write it, then your language is soykaf. External tools help, but you should be able to write a codebase in ed, if need be.

Finally, Java popularized excessive use of XML. XML is very good at document layout. It's not so great at being the language for your build system (I soykaf you not: they made a programming language in XML).


File: 1479858027825.png (44.61 KB, 200x132, lenin facepalm.jpg)

For me, the single major show stopper is Java's lack of by-value aggregate types. This makes it absolutely unusable for anything math-related which requires dealing with vectors/matrices.

First, it allocates all memory on the heap, which is a lot of overhead (like 20 bytes per object instance, garbage collection overhead, cache non-friendly etc). Second, hard to treat objects as immutables/by-values due to having to deal with #1. Ideally, you would just allocate a new instance, such as, Vector a = b.dot(c); but then I end up with something like fuarrrking 500 MB/sec allocation rates. Despite all the advertisement that Java's GC is mature enough to deal with it, it's not the case, I could have had better results. Escape analysis barely works. Then you think, OK I will butcher all my interfaces to do stuff in-place like: a_preallocated.DotInPlace(b, c).

Not only this is ugly, it also violates the principle of those objects being immutable. You can accidentally share a vector by reference, and then updating it in one place will make the change visible to some unrelated piece of code.

I got so annoyed about all this fuarrrkery, I had to switch to C++ entirely. In Java with all its much-advertised GC I had to manually manage my memory more often than I do in C++. In C++, I have RAII which automatically deals with those things. I implement a memory managing wrapper and forget about it. In Java, on the other hand, I must manually analyse every fuarrrking callsite in regards to memory usage. Such a fuarrrking step forward with memory management.





JAVA is written on C Read the manual / history.
it auto allocates buffers you don't need to worry about mapping & handling memory buffers.

running java on embed platforms http://www.oracle.com/technetwork/java/embedded/javame/index.html


JVM is C the classes et al are java interpreted through java virtual machine.
learn memory management. learn C POSIX.
check the standard.

C std: https://volafile.io/r/kUFzLJ (C.tar.gz)
open std: http://www.open-std.org/
gotta love std's


File: 1479898587123.png (383.77 KB, 142x200, 1456385755307.png)

if your on windies learn the windows api download linux distros BSD, system V, ubuntu.

setup ubuntu with encrypted drive.
restart cpu when your asked for the password dont enter it.
instead hold enter for 70 seconds or press enter 93 times pop you get a busybox shell. now fix the bug with the patch CVE.

this will give you an idea of codeflow restriction and lack there of. suitable users dorks only