Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Why is Java so huge

This thread is locked; no one can reply to it. rss feed Print
Why is Java so huge
Timorg
Member #2,028
March 2002

In reality it seems to be php and html. It has a gui provided by html, and seems to support all the concepts taught in introduction subjects. It supports inheritence, and interfaces. I am sure it supports lots of other high level language features that would make it suitable.

Python could be the language of choice, just no one has written a decent browser plugin or UI toolkit.

I just remember having to program with BCB and shudder a little.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

Arvidsson
Member #4,603
May 2004
avatar

Without Java we wouldn't have Minecraft which is THE indie game which has revolutionized indie business as we know it.

But I cant' get it to fucking run, so fuck Java!

type568
Member #8,381
March 2007
avatar

@mabbam

A'right, so it's below TCP, UDP but on par with IP :P
Still evil -.-'

bamccaig
Member #7,536
July 2006
avatar

It shouldn't be true with Java. It is the "university" language. People are taught how to use it. Even good programmers write Java applications that suck. :P

PHP junk is created by no-talent n00bs.

Universities don't teach people to use Java well... They teach them mostly their interpretation of the theories behind writing good software and some semi-correct practices and it's up to the students to put that knowledge into practice, which I've heard doesn't happen very often. I have heard stories of university graduates writing very stupid code. :P E.g. referencing GET/POST variables by numeric index into a string dictionary whose order is undefined, and overlooking and then fighting the need to implement server-side security mechanisms (on more than one occasion)... :-X And this was after years of employment in the field. :P

If you ask me, neither colleges nor universities can make you a good programmer. They can teach you the theories or practices, but it's up to the individual to actually filter out the good from the bad and use it effectively. I've heard a few examples of older programmers complaining about the "Java generation". I don't think that Java is necessarily the problem, but I do think that it's naive to focus on teaching Java to students. Learning a new language is easy, or at least it better be if you plan to make a career out of this. Instead of teaching them a language that holds their hand, they should throw them to the wolves and teach them C++ with GCC from the command line. >:( If they can't succeed in that environment then they shouldn't graduate, IMHO. The transition from C++ to Java is much easier than the other way around, so there's no reason it should be a problem for anyone. (And no, don't waste your breath saying that we should all be taught to program in assembly ... That's not the same thing and you know it :P)

verthex said:

Plus Java is a language full of object passing (obviously) so its hard to make the code fast since OOP is the only program design available.

Please verify the orientation of your encyclopedia. You may be holding it upside-down. Objects are implicitly passed by reference in Java (there is no other option), which is equivalent to passing a pointer, which is very efficient. :-/ Aside from that, there's a very miniscule penalty each time you dereference an object member, but it's completely negligible and will not drastically affect the performance of your application.

Hey, the guy who teaches us Java told us this is how we assign values to floats:

float x = (float)0.0;

I am not kidding. When confronted that it should be 0.0f without the cast, he said that "it is also okay". Go figure.

What's wrong with this:

Test.java#SelectExpand
1class Test 2{ 3 public static void main(String [] args) 4 {
5 float x = 0;
6 7 System.out.println("The value of x is '" + x + "'."); 8 } 9}

bamccaig@castopulence:~$ javac -Xlint Test.java
bamccaig@castopulence:~$ java Test
The value of x is '0.0'.
bamccaig@castopulence:~$ 

???

Oscar Giner
Member #2,207
April 2002
avatar

Quote:

ICMP is level 3. [en.wikipedia.org]

True, I got confused :-X.

bamccaig said:

For example, WinForms is effectively a wrapper over the Windows API (i.e., not really portable at all). Java, on the other hand, had a goal of being portable from day one, so I think that more effort is put into developing platform independence (something Microsoft doesn't really want and settles for as a compromise), which often means sacrificing performance.

That's a bad excuse. There are other multiplatform GUI frameworks that, also being very different from Win API, have very good performance (look at Qt for example). But it's not like .net GUI apps have very good performance either (although generally better than Java).

Quote:

There's a lot of redundancy that just doesn't make sense

You mean, like java's int vs Integer? :-/ I hated Java, as a language, just because of that :-X:P.

edit:

bamccaig said:

Instead of teaching them a language that holds their hand, they should throw them to the wolves and teach them C++ with GCC from the command line.

The best is to teach the best language for the problem at hand. At my uni, indeed they start teaching Java (it used to be Modula-2 before) in introductory courses, but then, when it comes to abstract data types, it's done in C++; OOP is done in Eiffel (and sometimes Java); system/OS programming in C and assembly. Then other more obscure languages, like Lisp and Prolog for artificial intelligence.

Neil Walker
Member #210
April 2000
avatar

I think it's just all down to doing it the proper way.

in float x=0, you're widening which is just an implicit cast as it's fine, but you'd add the explicit cast just because, maybe to show you haven't made a daft mistake in type or value.

If you have 'float x=0.0' that would fail because floating point numbers are double not float so the compiler thinks you're trying to narrow. I guess (float)0.0 and 0.0f are both just explicit casts and equal, just convention makes you use 0.0f as it's a literal, but there's nothing wrong with (float)0.0

[edit]
Indeed, if you are using Eclipse and enter 'float a=0.0;' the automatic solution to cast it changes it to (float)0.0 and not 0.0f.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

CursedTyrant
Member #7,080
April 2006
avatar

bamccaig said:

What's wrong with this:

0 is probably a bad example, but that's the one he used. Consider trying to use 0.1, then the best way is to use 0.1f, and not (float)0.1. :P

Even if they're equivalent, writing 0.1f is faster than (float)0.1.

---------
Signature.
----
[My Website] | [My YouTube Channel]

bamccaig
Member #7,536
July 2006
avatar

Even if they're equivalent, writing 0.1f is faster than (float)0.1.

There's no reason to think that is the case. The compiler should turn that into identical byte-code (i.e., no run-time conversation is needed).

Arthur Kalliokoski
Second in Command
February 2005
avatar

IIRC I had a compiler (Borland?) a dozen years ago that would stuff the integer representation into a float variable.

float num = 16;

so the floating point representation would take it as a quiet nan (?), exponent was zero. Then I saw in Allegro code that just the decimal point would fix it.

float num = 16.;

They all watch too much MSNBC... they get ideas.

Thomas Fjellstrom
Member #476
June 2000
avatar

bamccaig said:

There's no reason to think that is the case. The compiler should turn that into identical byte-code (i.e., no run-time conversation is needed).

I think he meant typing 0.1f is faster than (float)0.1

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

bamccaig
Member #7,536
July 2006
avatar

I think he meant typing 0.1f is faster than (float)0.1

Touché. :-[ I agree with that much. :P It's also easier to read.

jmasterx
Member #11,410
October 2009

bamccaig said:

Instead of teaching them a language that holds their hand, they should throw them to the wolves and teach them C++ with GCC from the command line. >:( If they can't succeed in that environment then they shouldn't graduate, IMHO.

Yes I completely agree with this. In my college programming class (in Java) we did not even cover what a package is or why they exist :O . We also did not cover any version control. If students are not even aware of compilers, linkers, version control, and in Java, packages, then how are they expected to succeed in the field just knowing:

JButton myButton = new JButton("I'm a Java Programmer!!!");

Because really the jist of what we covered were controls and action listeners.

Quote:

The transition from C++ to Java is much easier than the other way around, so there's no reason it should be a problem for anyone.

I really agree with this. I learned C++ on my own and then had my Java course. I never read a single page of the proposed Java book and finished the course with a perfect 100.0 . I must say, understanding pointers from C++ made it so easy when I transitioned to Java. I understood WHY ArrayLists<T> cannot use primitive types, and HOW Java, as my teacher puts it "magically" does things like memory management and polymorphism. Understanding function pointers and reference counted pointers from C++ made these concepts very easy to understand.

Therefore, even though a student may never need to use C++ in their every day work, if it is taught well, it makes every other language such as PHP, C#, Java etc very easy to learn. In real life I believe it is more of an asset to understand programming at a fairly low level in order to enable you to easily pick up any other language you are faced with because the reality is, you cannot just go job hunting for only Java Programmer positions, I fully expect my career as a programmer to encompass a variety of languages. The fundamental concepts I learned with C++ however will make learning new languages easier.

I should however note that in my Java Programming course, around 20% failed the course and around 40% were between 60 and 70 (60 is the passing grade in my part of Canada). Therefore I'm sure the argument most teachers would have is that they want students to pass. However, I do not think it is doing them a favor in the real world of programming. In the course I was in, with its difficulty, I'd say any grade below 90 was a failure to me.

bamccaig
Member #7,536
July 2006
avatar

^ This.

Today I stumbled across a rather good example of how shitty .NET actually is: System.UriBuilder. It's basically just a generic class for parsing and manipulating a URI. It consists of the URI scheme, username, password, host, port, path, query, and "fragment" (the part after the '#'). Pretty normal stuff. Look at this contrived example though:

Program.cs#SelectExpand
1using System; 2using System.IO; 3 4namespace Application 5{ 6 class Program 7 { 8 public static int Main(string[] args) 9 { 10 const string uri = "http://castopulence.org/fake?q=foo#bar"; 11 12 var builder = new UriBuilder(uri); 13 14 Console.WriteLine(builder); 15 16 // Oh, I want to modify the fragment, which is merely a dumb string:
17 builder.Fragment += "baz";
18 19 Console.WriteLine(builder); 20 } 21 } 22}

bamccaig@castopulence.org:~$ mcs Program.cs
bamccaig@castopulence.org:~$ mono Program.exe
http://castopulence.org:80/fake?q=foo#bar
http://castopulence.org:80/fake?q=foo##barbaz
bamccaig@castopulence.org:~$ 

--

C:\Users\bamccaig>csc Program.cs
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.


C:\Users\bamccaig>Program.exe
http://castopulence.org:80/fake?q=foo#bar
http://castopulence.org:80/fake?q=foo##barbaz

C:\Users\bamccaig>

:o ???

Things to note:

  • The redundant, explicit port was added because the scheme was recognized. It's unnecessary and only serves to clutter the URI. It was not specified in the original.

  • The Fragment property getter returns the '#' prefix, but the setter expects no prefix and adds one whether or not the string already begins with one. If you want to append onto it then you'd need to do something like this:

        builder.Fragment = builder.Fragment.Substring(1) + "baz";

  • Apparently in versions of .NET prior to 2.0, modifying either of the Query or Fragment properties would actually clear (i.e., erase) the other. :o This is confirmed by using the version 1.1 Mono compiler, mcs. The output of the second WriteLine when compiled with version 1.1 is http://castopulence.org:80/fake##barbaz[1].

References

  1. I would like to prevent the hyperlink, but the markup engine doesn't seem to let me...
Steve++
Member #1,816
January 2002

I don't really care about Java for web applications because they tend to just be for stuffy corporate things that I never have to use.

Obviously you're referring to enterprise editions earlier than version 6. JSF 2.0 + JPA 2.0 + EJB 3.1 + CDI 1.0 on GlassFish 3.1.1 is an excellent platform for building web apps that scale. Boilerplate code is almost non-existent. This version of the EE spec makes third party frameworks such as Spring and Struts irrelevant. I would agree that J2EE (i.e. 1.4 and earlier) were for big stuffy corporations with more money than sense. Java EE 5 was somewhere in the middle. Java EE 6 is made for the public web.

JSF 2.0 is leagues ahead of any ASP.NET MVC crap that Microsoft has released.

Compare the time spent installing Visual Studio 2010 (Professional or Premium) vs. JDK7 + NetBeans 7.0.1. Visual Studio is much slower.

Matthew Leverton
Supreme Loser
January 1999
avatar

But who uses JSF? I've never run across (Chicago area) for-hire "agile" web developer groups who use any Java related technologies as part of their core solution. In-house teams use Java, but only because the man upstairs says to. That's not to say JSF is no good; it's just a bit strange that no developers who actually get to pick their poison seem to use it.

I personally dislike Java and .NET for web applications because they are just too ridiculously convoluted and removed from actual web programming. They seem to solve problems that don't really exist except to the person who doesn't understand basic principles of web programming.

Steve++
Member #1,816
January 2002

I personally dislike Java and .NET for web applications because they are just too ridiculously convoluted and removed from actual web programming. They seem to solve problems that don't really exist except to the person who doesn't understand basic principles of web programming.

I guess that's just down to your taste and perhaps the type of projects you undertake. The subset of Java EE 6 I'm using is a very nice fit for my project. I had started with php, but it got too messy too quickly.

I'll admit, the learning curve for JSF 2.0 (even assuming you have a good working knowledge of Java, EJB 3.1 and JPA 2.0) is much steeper than that of PHP. But the problem with PHP is you inevitably need a framework to manage the complexity and cross-cutting concerns of larger web applications, whether that be your own framework or someone else's.

Quote:

But who uses JSF? I've never run across (Chicago area) for-hire "agile" web developer groups who use any Java related technologies as part of their core solution. In-house teams use Java, but only because the man upstairs says to. That's not to say JSF is no good; it's just a bit strange that no developers who actually get to pick their poison seem to use it.

I agree. It's hard to find a decent sized JSF2 community outside stackoverflow. My guess is that, just like EJB 3.x, JSF 2.0 suffers from the bad reputation earned by the previous version, 1.1. Although 2.0 is an evolution rather than a revolution, it's a pretty damn big step up, especially the AJAX support. Another thing to consider is that JSF 2.0 isn't available to organizations until they upgrade their application servers to the Java EE 6 compliant versions. As usual, the industry drags its heels when it comes to implementing the latest EE version.

J-Gamer
Member #12,491
January 2011
avatar

bamccaig said:

Instead of teaching them a language that holds their hand, they should throw them to the wolves and teach them C++ with GCC from the command line. >:( If they can't succeed in that environment then they shouldn't graduate, IMHO. The transition from C++ to Java is much easier than the other way around, so there's no reason it should be a problem for anyone. (And no, don't waste your breath saying that we should all be taught to program in assembly ... That's not the same thing and you know it :P)

We have learned the basics of OOP with Python, and after 6 weeks we transitioned to C++(and we had to compile our first programs from the command line :p). A week later, in another class, we started learning MIPS Assembly. Happy now? :D

PS: If we don't comment our code well enough, or don't keep to the code conventions, proper OOP etc. we won't be able to get much points...
I guess our university is the exception to the rule... All other universities teach Java.

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

l j
Member #10,584
January 2009
avatar

We had to start programming in Java and first had to compile and run everything from the command line.

They haven't taught us proper programming yet (I think they will though), but the teachers (or some of them...) do assume that we are smart enough not to write shit code. Just making the program work does not guarantee a good score.

Oh and we have also been taught a little bit of assembly.

james_lohr
Member #1,947
February 2002

bamccaig said:

Instead of teaching them a language that holds their hand, they should throw them to the wolves and teach them C++ with GCC from the command line. If they can't succeed in that environment then they shouldn't graduate, IMHO.

Practical content like this is boring to teach and boring to learn. A CS Degree is supposed to be theoretical. If you want to learn language/platform specific crap like this, then go study at some shitty polytechnic. This is the type of stuff that people can work out in their own time, and it most certainly should not be part of any self-respecting CS degree.

Thomas Fjellstrom
Member #476
June 2000
avatar

This is the type of stuff that people can work out in their own time, and it most certainly should not be part of any self-respecting CS degree.

Except MOST people don't, and won't.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

james_lohr
Member #1,947
February 2002

Except MOST people don't, and won't.

Which isn't really an issue. If they were smart and conscientious enough to get good grades at a good university, then they'll be able to pick this type of stuff up pretty quickly on the job. ...or they'll fail the tech-test and not get a job in the first place.

It's not really the University's problem. University is there to teach cool theory, not to create good/employable programmers. The less this is polluted by practical stuff that really belongs in a polytechnic, the better.

Thomas Fjellstrom
Member #476
June 2000
avatar

or they'll fail the tech-test and not get a job in the first place.

Except that doesn't happen. There are a lot of completely unqualified people getting jobs in IT. Probably because the people doing the hiring are just as unqualified.

Quote:

It's not really the University's problem. University is there to teach cool theory, not to create good/employable programmers. The less this is polluted by practical stuff that really belongs in a polytechnic, the better.

Are you trolling? I thought the point of university was to educate, and produce productive individuals. Or is it really that the only reason to go to university is if you want to become a professor, or research theorist?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Matthew Leverton
Supreme Loser
January 1999
avatar

Are you trolling?

Of course he is. There is some truth to what he's saying, but it's overstated. The term "computer science" is very general and means different things in different universities, but all of them should require proficiency in at least one language.

I majored in Theoretical Computer Science and took pattern recognition courses, AI, software design, etc. Most of those things would be very difficult to teach without presenting some practical problems that require one to program a solution.

But universities should focus on teaching programming concepts as opposed to going into lots of depth in a single language. Learning how to build your own data structure in C is more important than learning how to use the STL containers. (My university actually teaches IBM z/OS assembly as its introductory course.)

james_lohr
Member #1,947
February 2002

Are you trolling?

Always.

Quote:

I thought the point of university was to educate, and produce productive individuals. Or is it really that the only reason to go to university is if you want to become a professor, or research theorist?

Its purpose is to provide a strong theoretical basis, and to broaden the mind. Produce productive individuals? Are you trolling? :P

bamccaig
Member #7,536
July 2006
avatar

Practical content like this is boring to teach and boring to learn. A CS Degree is supposed to be theoretical. If you want to learn language/platform specific crap like this, then go study at some shitty polytechnic. This is the type of stuff that people can work out in their own time, and it most certainly should not be part of any self-respecting CS degree.

Which isn't really an issue. If they were smart and conscientious enough to get good grades at a good university, then they'll be able to pick this type of stuff up pretty quickly on the job. ...or they'll fail the tech-test and not get a job in the first place.

It's not really the University's problem. University is there to teach cool theory, not to create good/employable programmers. The less this is polluted by practical stuff that really belongs in a polytechnic, the better.

I completely agree. And with that in mind, a university degree should NOT be enough to get you a job in the industry. >:( They aren't teaching you to actually be useful so you shouldn't expect to be hired until you've proven yourself practically useful by other means (e.g., a portfolio of source code or a practical diploma). Unfortunately, that isn't what happens. University graduates are considered smarter and more useful, so they are picked first, and payed extra, but all too often they're actually useless because they don't know how to apply the theory that they've learned and mostly forgotten. Then they end up doing brilliant things like creating a new table in the database for every record and one of the "polytechnic" graduates has to come along and shred -uz their work and start over (with the budget already gone). >:(

I wish I could remember what this one graduate's thesis was about. It would make you cringe. They graduated cum load laude from their "university" though, IIRC.



Go to: