Reader's Digest version: Java is no better than C# or Python.
[QUOTE=Chandler;18412576]Reader's Digest version: Java is no better than C# or Python.[/QUOTE]
Um C# is worlds above Java. And Python is a scripting language completely incomparable to either.
[QUOTE=nullsquared;18408649]
And, of course, Java doesn't have assertions. Just exceptions. Which it used for EVERYTHING -.-[/QUOTE]
God, I hate the forced exception catching too.
Whenever I type something, Java is all like HURR, u must ketch dis xception to comple.
And 90% of the time I just catch the exception and ignore it because 90% of the time it's that god damn IOException that will never happen anyway. It only ever happens if you run out of hard drive space. What am I supposed to do then? The program can just crash for all I care.
[editline]08:54PM[/editline]
And one thing I like about Java is that you can compile it once and run it on any system. The only things I really have to account for are path names. But most of the time that's not even an issue because Java can use Unix style path names on Windows.
Unless you use that god-awful SWT. SWT has made my life miserable.
[QUOTE=PvtCupcakes;18413130]
Whenever I type something, Java is all like HURR, u must ketch dis xception to comple.
[/QUOTE]
:v:
For competitions we just append "throws Exception" onto the end of every function declaration, even main(). We can't be bothered with exceptions :v:
[QUOTE=nullsquared;18413318]:v:
For competitions we just append "throws Exception" onto the end of every function declaration, even main(). We can't be bothered with exceptions :v:[/QUOTE]
Yeah, but I hate doing that because it makes a chain reaction all the way up the stack. So I just catch and ignore.
I was doing a Java program for my CS class, and the morning it was due before I left for school I realized that I didn't close a file, so I fire up my laptop and open up a text editor and make the change.
When I got my grade back I lost 20 points for not catching an IOException when I closed the file so it wouldn't compile for my instructor. And he put a note like "You're supposed to throw the exception."
And then I'm like :suicide:
It works well for browser-based programs that you can't do in Javascript, and you don't want to shell out for Flash (or don't want to pirate it, or even Flash can't do what you want)
As for application programming, yeah, it sucks. Some stuff is worse, though. "Everything is an object" is nothing compared to "everything is a function" or "everything is a cons-cell". I wonder what the worst "everything is a _____" could be...
nullsquared has aspergers
I hate C++, it's horrible. It's syntax is bad, it's needlessly complicated. Classes and all that shit are ridiculous.
[QUOTE=Jawalt;18413961]I hate C++, it's horrible. It's syntax is bad, it's needlessly complicated. Classes and all that shit are ridiculous.[/QUOTE]
what do you usually program/code/script in then?
i hope you're trolling by the way.
[QUOTE=fngrbng;18413982]what do you usually program/code/script in then?
i hope you're trolling by the way.[/QUOTE]
Probably C. :smug:
[QUOTE=nullsquared;18407985]Compare it to another language like C++ or C# and, yes, it is actually that bad.
The only positive argument I've heard so far is "GUI." .... use C# for GUI stuff.[/QUOTE]
Curly brackets and semicolons are for fags.
[QUOTE=PvtCupcakes;18413405]So I just catch and ignore.[/QUOTE]
Um yeah, good luck with that.
[QUOTE=Ortzinator;18414557]Um yeah, good luck with that.[/QUOTE]
Well sometimes I print a stack trace. But I normally don't go to Plan B.
I usually handle all the worst case scenarios with a few if statements.
C# is Java done right. I feel that with everything you mention, C# is a bit similar, but just different enough to fix it [I]properly[/I]. For example, the out and ref keywords.
On the other hand, D does almost everything C# does, except it tends to be tons faster because of powerful metaprogramming features (more so than C++) and it being a systems programming language.
My two cents :v:
[QUOTE=PvtCupcakes;18413130]And 90% of the time I just catch the exception and ignore it because 90% of the time it's that god damn IOException that will never happen anyway. It only ever happens if you run out of hard drive space. What am I supposed to do then? The program can just crash for all I care.[/QUOTE]
[QUOTE=PvtCupcakes;18413405]Yeah, but I hate doing that ["throws Exception"] because it makes a chain reaction all the way up the stack. So I just catch and ignore.[/QUOTE]
If you've encountered an error that you can't handle, it's [i]better[/i] to let the exception go all the way up the stack and terminate the program than to close your eyes and blindly continue as if nothing ever happened. At least that way you get a stack trace that points to the place where the problem occurred. If you ignore and continue, the program will likely just misbehave later in some confusing way that may not have any apparent connection to the exception that was ignored earlier, making it much more difficult to figure out what the problem is.
Ignoring exceptions can also have more serious consequences. Imagine you have a program that creates a new version of some important data file, then deletes the old one. If you ignore an exception while creating the new file, then continue and delete the old file, now you have no file.
Don't put "throws Exception" on a method that logically shouldn't be able to throw anything other than IOException, though. Use "throws IOException".
[editline]11:32PM[/editline]
[QUOTE=PvtCupcakes;18414593]Well sometimes I print a stack trace[/QUOTE]
In the real world, catch(Exception e) { e.printStackTrace(); } is a hallmark of shoddy software.
[QUOTE=jA_cOp;18414671]C# is Java done right. I feel that with everything you mention, C# is a bit similar, but just different enough to fix it [I]properly[/I]. For example, the out and ref keywords.
On the other hand, D does almost everything C# does, except it tends to be tons faster because of powerful metaprogramming features (more so than C++) and it being a systems programming language.
My two cents :v:[/QUOTE]
Also C# is evolving and being improved constantly.
catch( Exception e ) { e.printStackTrace(); } is really just a symptom of bad API design. The folks at Sun should have used more unchecked exceptions where appropriate. I don't really know what the best way to do this would be, but maybe more state-testing methods so you can do
[cpp]
if( obj.canFoo( args ) )
{
obj.foo( args );
}
else
{
// exceptional condition
}[/cpp]
but that doesn't really make things much prettier. Although this way if you are content letting the thread terminate if the call fails, you can just call the method and that's it.
Important parts of the Java API are poorly designed, that is one of the major faults I have seen in it. Anyone wanna guess what [url=http://java.sun.com/javase/6/docs/api/java/lang/Boolean.html#getBoolean(java.lang.String)]Boolean.getBoolean()[/url] does?
[editline]09:24PM[/editline]
[QUOTE=Ortzinator;18414938]Also C# is evolving and being improved constantly.[/QUOTE]
Both languages are.
[QUOTE=tjl;18415850]
Both languages are.[/QUOTE]
Shit evolving into more shit?
[QUOTE=ButtsexV2;18414351]Curly brackets and semicolons are for fags.[/QUOTE]
Because fags who don't use lube end up with impacted colons.
Now really, OP? Did such an assertion really warrant a whole thread? Sure Java sucks, and I would hope that the people who use it are keen on its issues, just as I hope you are keen on the issues with C and C++ and yet still choose to use them. There [i]are[/i] reasons to use Java, such as the entirely virtualized environment that ensures physical hardware or the OS it sits on never becomes an issue.
I'm all about learning as many languages as you can and then making a subjective judgement for yourself. I'm sure all of you have heard my arguments about why I use C, and everyone bitches and moans about me not being as fond of C++. Seriously, unless they aren't using the language effectively or intelligently, then you have nothing to bitch about.
[QUOTE=tjl;18415850]catch( Exception e ) { e.printStackTrace(); } is really just a symptom of bad API design. The folks at Sun should have used more unchecked exceptions where appropriate. I don't really know what the best way to do this would be, but maybe more state-testing methods so you can do
[cpp]
if( obj.canFoo( args ) )
{
obj.foo( args );
}
else
{
// exceptional condition
}[/cpp]
but that doesn't really make things much prettier. Although this way if you are content letting the thread terminate if the call fails, you can just call the method and that's it.[/QUOTE]
That's a race condition. The condition might be true when you call canFoo(), but false a moment later when you call foo() -- imagine that the disk happens to become full at that moment, or the network connection gets closed by the remote end, or whatever.
Catching and printing a stack trace isn't a symptom of a bad API design, it's a symptom of a developer thinking s/he should catch the exception but not actually knowing what to do with it. It's a cop-out.
Appropriate things to do with an exception:
[list]
[*]If you can meaningfully handle the exception (that means getting the program back into a sane state so that it can safely continue), catch it and handle it.
[*]If you can't handle the exception, but you want to provide additional information about the context of the problem, or you don't want to expose implementation details to things higher up the stack, catch the exception and throw a new exception with the original one as the "cause" parameter. (This is called "wrapping" the exception.)
[*]If you can't handle the exception and don't need or want to wrap it, don't catch it at all. Just let it go up the stack.
[/list]
Example of exception wrapping:
[cpp]
GameData loadSavedGame(final File file) throws GameLoadException {
try {
// ...
}
catch (final IOException e) {
throw new GameLoadException("Failed to load game from file: " + file, e);
}
}
[/cpp]
I disagree when you say that it isn't a symptom of bad design. There are a few checked exceptions that the JDK will throw that should really have been unchecked exceptions (CloneNotSupportedException being the one I can think of ATM, also java.sql.SQLException).
Here are the 2 conditions for throwing a checked exception:
1. The exceptional condition cannot be prevented by proper use of the API
2. The programmer using the API can take some useful action when confronted with the exception.
CloneNotSupportedException fails both of these conditions.
If the programmer is just going to catch the exception and ignore it, usually it is better to throw an unchecked exception instead.
I agree that there are a few checked exceptions that ought to have been unchecked, but if you can't handle them and you don't want to expose the exception type to higher layers with a "throws" clause, it's better to wrap them in a RuntimeException and re-throw than to print a stack trace and continue with the program in an erroneous state.
My first foray into programming was actually with Java.
It being my first foray, I was overwhelmed by all the OOP talk at the beginning of the official Java tutorial.
Then I discovered Visual C++ Express 2005 and cprogramming.com and found my love :v: We've been together since.
However, now that I know a lot more about OOP than I did around 4 years ago, I think I want to give Java another whirl sometime.
Well Java does suck, but it's not slow. It's at least on par with .NET languages.
That said my actual point is that I think the whole niche which Java / C# fit into should be abandoned as absolutely worthless. They're half way between scripting and systems languages, and inherit few of the benefits, and many of the downsides of both. They're slower than 'real' languages, they're less productive than scripting languages. They run in a massive virtual machine, and end up wrapping huge amounts of native OS functionality in order to be useful. They're portable in some ways (port the vm and theoretically you've ported every app), but really not in others(porting a vm for a small project is overkill).
For mine you take a modern high level systems language, (D, Go, (if you're desperate even not so modern languages, C, C++)), add a lightweight powerful scripting language, (Lua, JavaScript (or a not so lightweight one, Python) and you have everything you need.
Look at the direction of the gnome platform, C might be old, but what they've done with GObject introspection is amazing. You write a GObject library in C, and you get magic bindings to scripting languages. So they're moving towards a solid base which provides the standard libraries all these monolithic environments package, with automatic bindings for ease of code generation. For mine this is an excellent solution and effectively removes the need for half way measures like C# and Java.
I started out with Java, at that time it was just too complicated to me and I jumped over to a bunch of other programming languages. My final choice is C++, it's uncomparable to any other language that I've tried, including Java.
[QUOTE=nullsquared;18410272]BTW, C++ is not interpreted.[/QUOTE]
It's a verb. He could've used "Understand", too.
[QUOTE=nullsquared;18410272]C++ modules build by different compilers won't work because different compilers use different name mangling. This isn't a C++ issue.[/QUOTE]
It is a C++ issue. The standard body could define a standard way to do name mangling, but they don't. It makes it a lot more difficult when things aren't defined.
[QUOTE=nullsquared;18410272]Development tools for C++ lack features and are unreliable? Never used MSVC and VAX?[/QUOTE]
Debugging is quite harder in C++ compared to modern languages like C#; since you've used it, you should know. Inspecting some standard containers and char pointers to arrays (argv), for instance, are a lot simpler in C# (It looks like VS has some helpers for this, however.) As for VAX, I use Resharper, so I don't have it installed. Which is good, because plain intellisense is fucking awful.
[QUOTE=nullsquared;18410272]I'm not so sure if I want to read that FQA.[/QUOTE]
Of course you do. It brings up a lot of very valid issues; of course, some are debatable, and some won't even be understandable unless you're litb, but it's a look upon what parts of C++ could use some work.
[QUOTE=nullsquared;18410272]And I don't think the author has heard of boost.[/QUOTE]
He's been coding for longer than you have and still uses C++ extensively. He's criticizing something he knows very well, because he uses it every day. It's not just some kid ranting on a programming forum. about a language he used at college/uni.
You can probably come up with a counter point to everything he says, people have done it before (and have been proven wrong, of course). Just email him and hear what he has to say.
I can do the same thing with your original post (that is, make null and void every single one of your point, just like you'll probably waste your time doing the same thing with mine). But that's because a lot of them are a matter of opinion. For instance, I don't find operator overloading particularly important; it can even be problematic.
[QUOTE=nullsquared;18410272]Maybe because ifstream came before string?[/QUOTE]
So what? It looks like they were both part of the 1997 C++98 draft, and so ifstream could've easily have had a std::string constructor back then. And even if it didn't, do I need to remind you that C++03 was released in (drumroll) 2003? They can't add a constructor to a class in 5 years or work? Why should I have to use .c_str() every time? It makes no sense. At all.
Wow, why are you bothering to try and compare C# and C++?
[QUOTE=PvtCupcakes;18414124]Probably C. :smug:[/QUOTE]
QBASIC/FreeBASIC I <3 case insensitivity. I also enjoy the simple syntax, and that I can use them procedurally or linearly. I usually only use FreeBASIC, though.
[QUOTE=gparent;18422161]:words:[/QUOTE]
[QUOTE=high;18423017]Wow, why are you bothering to try and compare C# and C++?[/QUOTE]
Yeah that, I'm not comparing C# and C++. Actually I'm not comparing anything. In case you completely missed the thread, it's called "Java is utter shit."
And I'd love for you to come up with a counter argument to my every point. Go ahead.
(And that FQA is completely biased (actually, first time I read it, I thought it was a joke) - the author's stance is basically "C++ has no garbage collection and makes you do things manually therefore it is shit" - pretty much every one of his answers mentions how C++ has no garbage collection, yet he fails to mention boost::shared_ptr or anything of the sort (or boost at all))
[QUOTE=nullsquared;18424416](And that FQA is completely biased (actually, first time I read it, I thought it was a joke) - the author's stance is basically "C++ has no garbage collection and makes you do things manually therefore it is shit" - pretty much every one of his answers mentions how C++ has no garbage collection, yet he fails to mention boost::shared_ptr or anything of the sort (or boost at all))[/QUOTE]
Wow you really are childish. Just because you love your favorite toy doesn't mean it's the greatest toy in the world, hell it might even be fundamentally broken.
The author's stance is that there are a lot of things that could be seen as features or failures as individual items, but as a whole the trend is that it is a flawed language. If you run around thinking everything you think you know is gospel you'll never get anywhere, and if you blow things off because they don't conform strictly to your world view, you'll never get anywhere.
On boost, he's talking about C++, not a bundle of (useful, but that's not the point) external libraries which tack on even more features to an already bloated language. (the last bit there is my own feeling on the matter)
[url]http://yosefk.com/c++fqa/defective.html[/url] read the summary.
Sorry, you need to Log In to post a reply to this thread.