Non-programming question about Java...
-
mark merrens wrote:
Get a 5 for balance: no idea why this would be down-voted.
Thanks. Must be my colleagues and friends who cannot approve of my point of view regarding Java ;p
mark merrens wrote:
It's just another tool, no more, no less. Use it if it fits the task.
Yeah sure, although the definition of a bad language may be that it does not fit any task ;) Of course that's hardly the case with Java as it fits almost any task...
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
} -
I like Java! I prefer programming in NetBeans for an IDE. Java is not horrible.
If it moves, compile it
-
I don't think the language is terrible, but I think the run time is a steaming pile.
CPallini wrote:
You cannot argue with agile people so just take the extreme approach and shoot him. :Smile:
Shelby Robertson wrote:
I don't think the language is terrible, but I think the run time is a steaming pile.
Meaning what exactly? That it is buggy? That you have a problem with performance? I haven't seen the former. And the latter is meaningless in standard business programming because in the vast majority of cases language choice will have not impact on that.
-
There's nothing particularly horrible about Java at all. I don't like the syntax, but I never liked C/C++ either; that's just a personal preference. Part of the horror of Java, I suppose, is that for a long time people were trying to make it do everything, while its designers intended it to run smart coffee pots. Over time, things got better, expectations got more realistic, and the language (along with its libraries) got a lot better. Enjoy it... :-D
Will Rogers never met me.
Roger Wright wrote:
There's nothing particularly horrible about Java at all. I don't like the syntax, but I never liked C/C++ either; that's just a personal preference.
Versus what language? C#? The overall structure of C# is similar to C++ and Java. Versus Perl? Cobol? Fortran? Those are different from C#, C++ and Java.
-
It's not horrible. That's typical 'language war' overstatement. But it is just a bit worse than C# in pretty much every way (I really can't think of a single advantage now that Mono/Moonlight clears up most of the 'cross platform' thing that Java used to have over everyone else):
- No properties; code looks less tidy and you get 'paren fatigue' trying to read it
- LINQ is awesome
- Java's generics are a bad post-hoc hack that don't really work properly (for example you can't use T.class or have two method overloads which take different types of List)
- Package visibility is much less useful than internal in .Net
- csc directly produces a usable DLL/EXE; javac produces something you need a build tool to turn into something runnable
- lambdas and delegates
- proper events as a language feature
- Lots of minor things that make code nicer to read (typeof(T), is and as instead of instanceof, upper case convention etc)
- Much better UI libraries in the framework (AWT and Swing are notoriously awful; WinForms and WPF are both pretty good)
- Better thought out collections in the framework (see also Generics, above)
There's also the community, which isn't really the fault of the language, but Java is the source of most of the 'factory factory factory pattern' type of thinking.
BobJanova wrote:
But it is just a bit worse than C# in pretty much every way (I really can't think of a single advantage now that Mono/Moonlight clears up most of the 'cross platform' thing that Java used to have over everyone else):
AppDomains are absolutely miserable compared to class loaders.
-
It depends on the point of view. When Java was introduced, it brought to production a lot of great ideas (including garbage collection). But, after 6 years of almost no evolution and the horrible handling of the Sun acquisition by Oracle, it's been left behind. The fact that there are a lot of legacy libraries not ready to use later language developments and the object-oriented dogmatism of the java community just add insult to injury. At a language (not platform) level, there is almost nothing java can do that c# cannot do, while there are plenty of things C# can do with much less code than java (think of dynamic types, lambdas and other functional programming consrtucts, implicit strong typing and all things that make for example ASP.NET MVC so wonderfull concise). In the end, most Java programs I've seen are very verbose. Some of the best professionals know when to use other languages based on the JVM (like groovy) to make coding more concise, but it's not a widespread practice. Java's slowly becoming the new COBOL.
tecgoblin wrote:
C# can do with much less code than java (think of dynamic types, lambdas and other functional programming consrtucts, implicit strong typing and all things that make for example ASP.NET MVC so wonderfull concise).
You must work in a different world than I do. Those sort of things have a very minimal place in code. Thus by themselves they certainly cannot have anything to do with "less code". Not to mention of course that "less code" has almost zero impact on the cost of developing software.
tecgoblin wrote:
Some of the best professionals know when to use other languages based on the JVM (like groovy) to make coding more concise, but it's not a widespread practice
Which of course completely ignores the cost of maintaining code. If you yourself maintain all the code you have every written then it isn't a problem. But if you write code for a company and decide that it is fun to wander down every single technology path that comes along then those that follow must also learn every one of those. And that costs money.
-
I ran your code with the System.Timers.Stopwatch and I got the following on x64: Struct elapsed time: 84 (10000000) Primitive elapsed time: 66 (10000000) Struct elapsed time: 70 (10000000) Primitive elapsed time: 58 (10000000) Struct elapsed time: 69 (10000000) Primitive elapsed time: 59 (10000000) Struct elapsed time: 69 (10000000) Primitive elapsed time: 61 (10000000) Struct elapsed time: 70 (10000000) Primitive elapsed time: 58 (10000000) Interestingly, the differences are actually similar when run under x86 which is not supposed to have this problem.
Closer timings than on my machine, do you think it's due to the StopWatch? Can't image. The matter is definitely quite obscure, so I wouldn't dare to speculate about why it's still slower on x86.
Wout
-
BobJanova wrote:
But it is just a bit worse than C# in pretty much every way (I really can't think of a single advantage now that Mono/Moonlight clears up most of the 'cross platform' thing that Java used to have over everyone else):
AppDomains are absolutely miserable compared to class loaders.
-
tecgoblin wrote:
C# can do with much less code than java (think of dynamic types, lambdas and other functional programming consrtucts, implicit strong typing and all things that make for example ASP.NET MVC so wonderfull concise).
You must work in a different world than I do. Those sort of things have a very minimal place in code. Thus by themselves they certainly cannot have anything to do with "less code". Not to mention of course that "less code" has almost zero impact on the cost of developing software.
tecgoblin wrote:
Some of the best professionals know when to use other languages based on the JVM (like groovy) to make coding more concise, but it's not a widespread practice
Which of course completely ignores the cost of maintaining code. If you yourself maintain all the code you have every written then it isn't a problem. But if you write code for a company and decide that it is fun to wander down every single technology path that comes along then those that follow must also learn every one of those. And that costs money.
Lambdas and Linq queries certainly don't have 'a very minimal place in code' in any vaguely up to date .Net development. You are correct about not taking on every cool piece of technology but those language features have made it to the mainstream.
Not to mention of course that "less code" has almost zero impact on the cost of developing software.
I really disagree with that. More code means more time to maintain it, more familiarisation time when bringing new people onto the project, more difficulty in understanding the whole system and more difficulty tracking down the right place to change something when modifying a program. That's why we use high level languages and frameworks in the first place!
-
Shelby Robertson wrote:
I don't think the language is terrible, but I think the run time is a steaming pile.
Meaning what exactly? That it is buggy? That you have a problem with performance? I haven't seen the former. And the latter is meaningless in standard business programming because in the vast majority of cases language choice will have not impact on that.
Given that my experience with it is limited to screwing around with it on my own time to see if it was worth learning, I found the runtime slow, buggy, and general pain to deal with (different runtime versions not playing well etc)
CPallini wrote:
You cannot argue with agile people so just take the extreme approach and shoot him. :Smile:
-
Given that my experience with it is limited to screwing around with it on my own time to see if it was worth learning, I found the runtime slow, buggy, and general pain to deal with (different runtime versions not playing well etc)
CPallini wrote:
You cannot argue with agile people so just take the extreme approach and shoot him. :Smile:
Shelby Robertson wrote:
buggy
You were doing limited use with a recent Oracle VM and found a bug in the VM itself? Or a bug in the API?
Shelby Robertson wrote:
runtime slow
The context that you suggested does not lend itself to that conclusion. There can be some very limited problem domains where that could be relevant and perhaps you were experimenting in those domains.
Shelby Robertson wrote:
and general pain to deal with (different runtime versions not playing well etc)
I am not sure what that means. But different versions of the VM do not run together at all.
-
Naerling wrote:
I've heard some colleagues and friends say that Java is absolutely terrible, so I wasn't to happy about having to use Java.
Certainly if there was no context with those comments then I would dismiss them as at best ignorant and and worse it might indicate that the commenter isn't very smart.
Naerling wrote:
and the Namespace Imports (using),
Huh? Java has import. And in terms of syntax I haven't seen any difference between those two.
Naerling wrote:
Am I missing something or is Java just not the horrible language I was told it is?
Without a context it doesn't mean anything. Various preferences that I can note. - I like the power of C++ templates, memory management and pointers (emphasizing the power here.) - C# app domains are a poor substitute for Java's class loaders. I have yet to see any way in which they are better and quite a few ways in which they are worse. - I like C# properties. - I dislike the ease of C# Linq especially since it can lead to connection leaks (which I have seen.) - I dislike the C# exception handling versus Java. With C# one MUST capture exceptions in every thread or it will take down the application. And there is no equivalent global catch unlike Java. - I like C#/Java null reference exception, array boundary checks and various other exceptions that originate from programming bugs and which C++ merely fails. - In general I prefer the app to handle memory for me in C#/Java (even despite liking the control in C++.) - I like how fast I can put together a simple tool, especially parser/interpreters in Perl. The same thing would take longer and with more code in C#, Java and C++.
jschell wrote:
Huh?
Java has import. And in terms of syntax I haven't seen any difference between those two.As far as I understood the difference would be the following: C#:
// Only one using statement for the entire namespace.
using System.Collections.Generic;public class SomeClass
{
List<String> someList;
Dictionary<String, String> someDict;
IEnumerable<Object> ienum;
}And now C#, but using the 'Java mindset'.
// Every class needs another using statement.
using System.Collections.Generic.List<T>;
using System.Collections.Generic.Dictionary<TKey, TValue>;
using System.Collections.Generic.IEnumerable<T>;public class SomeClass
{
List<String> someList;
Dictionary<String, String> someDict;
IEnumerable<Object> ienum;
}It tends to make the list of using statements quite long :)
jschell wrote:
Various preferences that I can note. etc...
Nice! I'm not very familiar with C++ (but I do want to learn it someday). I don't know Perl at all (just by name). Is it worth the trouble to learn?
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
} -
Lambdas and Linq queries certainly don't have 'a very minimal place in code' in any vaguely up to date .Net development. You are correct about not taking on every cool piece of technology but those language features have made it to the mainstream.
Not to mention of course that "less code" has almost zero impact on the cost of developing software.
I really disagree with that. More code means more time to maintain it, more familiarisation time when bringing new people onto the project, more difficulty in understanding the whole system and more difficulty tracking down the right place to change something when modifying a program. That's why we use high level languages and frameworks in the first place!
BobJanova wrote:
Lambdas and Linq queries certainly don't have 'a very minimal place in code' in any vaguely up to date .Net development.
So in your significant business applications what percentage of the entire code base do those idioms represent? And what percentage do they represent if boiler plate database API code is not included (since of course with code generation and/or frameworks all of that can be removed as a maintenance item)?
BobJanova wrote:
More code means more time to maintain it
Nope. If your code base is 1000% bigger than mine and our products do the same thing then I would in fact expect that your maintenance cost is higher than mine. However there is no way that language syntax is going to produce that differential. However poor programming can and does. On the other hand a differential of 1% or less is not going to have any measurable impact on maintenance. And would be lost in the noise.
BobJanova wrote:
more familiarisation time when bringing new people onto the project, more difficulty in understanding the whole system and more difficulty tracking down the right place to change something when modifying a program.
All of those same things happen when there is a muddled design, muddle requirements/business needs, code grown re-actively (rather than planned), mixed language usage (even when justified), no process control, etc, etc, etc. And since it is more likely that any or all of those things will occur in the average shop it is going to be flat out impossible to measure the impact that any single language feature would have on actual maintenance costs.
-
jschell wrote:
Huh?
Java has import. And in terms of syntax I haven't seen any difference between those two.As far as I understood the difference would be the following: C#:
// Only one using statement for the entire namespace.
using System.Collections.Generic;public class SomeClass
{
List<String> someList;
Dictionary<String, String> someDict;
IEnumerable<Object> ienum;
}And now C#, but using the 'Java mindset'.
// Every class needs another using statement.
using System.Collections.Generic.List<T>;
using System.Collections.Generic.Dictionary<TKey, TValue>;
using System.Collections.Generic.IEnumerable<T>;public class SomeClass
{
List<String> someList;
Dictionary<String, String> someDict;
IEnumerable<Object> ienum;
}It tends to make the list of using statements quite long :)
jschell wrote:
Various preferences that I can note. etc...
Nice! I'm not very familiar with C++ (but I do want to learn it someday). I don't know Perl at all (just by name). Is it worth the trouble to learn?
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}Naerling wrote:
And now C#, but using the 'Java mindset'.
No. Actual pseudo syntax would be as follows. using System.Collections.Generic.*; // Asterisk. And C# is basically the same way since you can explicitly name classes via using with the following. using MyClass = MyPackage.MyClass;
-
jschell wrote:
Huh?
Java has import. And in terms of syntax I haven't seen any difference between those two.As far as I understood the difference would be the following: C#:
// Only one using statement for the entire namespace.
using System.Collections.Generic;public class SomeClass
{
List<String> someList;
Dictionary<String, String> someDict;
IEnumerable<Object> ienum;
}And now C#, but using the 'Java mindset'.
// Every class needs another using statement.
using System.Collections.Generic.List<T>;
using System.Collections.Generic.Dictionary<TKey, TValue>;
using System.Collections.Generic.IEnumerable<T>;public class SomeClass
{
List<String> someList;
Dictionary<String, String> someDict;
IEnumerable<Object> ienum;
}It tends to make the list of using statements quite long :)
jschell wrote:
Various preferences that I can note. etc...
Nice! I'm not very familiar with C++ (but I do want to learn it someday). I don't know Perl at all (just by name). Is it worth the trouble to learn?
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}Naerling wrote:
I don't know Perl at all (just by name). Is it worth the trouble to learn?
I do a lot of code generation. Ideally I would prefer to use the language of the shop (C#, Java, C++) to do code generation but it requires writing so much more code that it just is not worth it.
-
Naerling wrote:
And now C#, but using the 'Java mindset'.
No. Actual pseudo syntax would be as follows. using System.Collections.Generic.*; // Asterisk. And C# is basically the same way since you can explicitly name classes via using with the following. using MyClass = MyPackage.MyClass;
Ahhh... Didn't know the * was also valid syntax. I guess those introductions don't tell you everything :)
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
} -
So I've made my first aquintance with Java since I need it for my study at OU. I've heard some colleagues and friends say that Java is absolutely terrible, so I wasn't to happy about having to use Java. I started using JCreator (which looks nice, but is quite limited in features). After that I was introduced to Eclipse which looks a lot better. Of course the editor has nothing to do with the language, but it makes programming in it a lot more pleasant. So what did I think of Java? It's not bad. Missing the Properties of C# and the Namespace Imports (using), but they're stuff I can get used to. I could run it on my desktop or in my browser without much trouble. Am I missing something or is Java just not the horrible language I was told it is?
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}Java is a language which has been promoted by students, academics, and computer scientists. Because of this foundation, the language has been made much more complex than necessary limiting its use to only those who like such environemnts. Microsoft's .NET, in my opinion, is a far superior environment to work in (and yes, I am a .NET specialist) due to its easier learning curves and better intergated tools. That being said, Java is just as good as .NET in terms of capability, which is enhanced by the NetBeans platform, which mirrors the capabilities of Microsoft's Visual Studio. Your colleagues who have found Java to be a difficult language to work with may just see it as such due to the style of the environments that Java offers, which once again is based upon its historical foundations in academia and computer science. If you use the right tools (ie: Netbeans) and obtain some good manuals (ie: O'Reilly), it will make working with this language a far more enjoyable experience...
Steve Naidamast Black Falcon Software, Inc. blackfalconsoftware@ix.netcom.com
-
So I've made my first aquintance with Java since I need it for my study at OU. I've heard some colleagues and friends say that Java is absolutely terrible, so I wasn't to happy about having to use Java. I started using JCreator (which looks nice, but is quite limited in features). After that I was introduced to Eclipse which looks a lot better. Of course the editor has nothing to do with the language, but it makes programming in it a lot more pleasant. So what did I think of Java? It's not bad. Missing the Properties of C# and the Namespace Imports (using), but they're stuff I can get used to. I could run it on my desktop or in my browser without much trouble. Am I missing something or is Java just not the horrible language I was told it is?
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}Personally I love the language, and with good dev tools like Netbeans and Eclipse emerging, its just getting better. As the second most popular language after C, it cant be going too wrong, and before dotNet Microsoft tried to steal it, for those that remember. The real issue is just that, one guy owns the platform, another a cool language, the guy with the platform (like Microsoft) makes a cool video system but licenses it so the platform above Java cant use it... and so the language has a Multimedia deficiency. Its the business end that is "where its really at", and keeping your eye on what these warring platforms get up to. This is how I use Java... and it scares the hell out of all the big platform boys. http://ecoamigo.herobo.com/POJO/ so I think its safe to say that Java is still very much in the game. If you consider that big players like Android/Google/IBM/Sun/Oracle are also very much in the Java game, I think its safe to say that the dotNet Java battle is far from over. Also look at things like the Apache Project... I fell in love with Java when Microsoft brought it out, yes!... and the love affair hasn't stopped.
-
I don't think the language is terrible, but I think the run time is a steaming pile.
CPallini wrote:
You cannot argue with agile people so just take the extreme approach and shoot him. :Smile:
Java is a modern procedural object-oriented language with garbage collection. It's really not that much different to C# and several other less common languages. Of course, the details are different and good programmer output requires language familiarity. A lot of language bitching is related to familiarity and habits of thought. Java's real success is in server applications due to it's platform independence. For the vendor, this means they can maintain a single core code base and sell to the customer's preferred platform, including Windows, Linux, Sun, IBM, and more. The vendor might have a little platform specific code and tweaks, eg, installers and launchers, but the core 99% of their code runs on any JVM. For the customer there is less platform tie-in although in practice this typically doesn't amount to much: customers will stick with their familiar platform. So the platform independence really translates to product availability for their house platform. JVMs are mature technology: fast, stable, scalable and tuneable. Java and the JVM is great for writing web applications and several good Java application server platforms are available that handle the connection and management stuff. Java has a pluggable library set that is roughly comparably to dotnet, with pluses and minuses. There are often a few different Java libraries available for a particular purpose including a lot of good open source. When debugging Java you tend to make it to the actual source rather than hitting a blackbox function call. A variety of other languages have been subsequently written for or ported to the JVM because it is a reliable standard. The case for Java on the desktop is a little weaker but the same argument applies. Zippy UIs are better written in native languages but generic system tools - things like ldap directory browsers or log analysers - are commonly written in Java.
If, after hearing my songs, just one human being is inspired to say something nasty to a friend, or perhaps to strike a loved one, it will all have been worth the while." - Tom Lehrer
-
Java is a modern procedural object-oriented language with garbage collection. It's really not that much different to C# and several other less common languages. Of course, the details are different and good programmer output requires language familiarity. A lot of language bitching is related to familiarity and habits of thought. Java's real success is in server applications due to it's platform independence. For the vendor, this means they can maintain a single core code base and sell to the customer's preferred platform, including Windows, Linux, Sun, IBM, and more. The vendor might have a little platform specific code and tweaks, eg, installers and launchers, but the core 99% of their code runs on any JVM. For the customer there is less platform tie-in although in practice this typically doesn't amount to much: customers will stick with their familiar platform. So the platform independence really translates to product availability for their house platform. JVMs are mature technology: fast, stable, scalable and tuneable. Java and the JVM is great for writing web applications and several good Java application server platforms are available that handle the connection and management stuff. Java has a pluggable library set that is roughly comparably to dotnet, with pluses and minuses. There are often a few different Java libraries available for a particular purpose including a lot of good open source. When debugging Java you tend to make it to the actual source rather than hitting a blackbox function call. A variety of other languages have been subsequently written for or ported to the JVM because it is a reliable standard. The case for Java on the desktop is a little weaker but the same argument applies. Zippy UIs are better written in native languages but generic system tools - things like ldap directory browsers or log analysers - are commonly written in Java.
If, after hearing my songs, just one human being is inspired to say something nasty to a friend, or perhaps to strike a loved one, it will all have been worth the while." - Tom Lehrer
I'm humbled by your sorcerous skill at casting maximized wall of text.
CPallini wrote:
You cannot argue with agile people so just take the extreme approach and shoot him. :Smile: