Why Java sucks
Author |
Message |
Prabhakar Ragde
|
Posted: Thu Jun 18, 2009 8:20 am Post subject: Re: RE:Why Java sucks |
|
|
rizzix @ Wed Jun 17, 2009 11:52 pm wrote: By that logic, reading input from the terminal should have two separate methods:
1) Read input from terminal.
2) Return the read input.
Clearly including them both in a single function voids referential transparency.
I/O functions can't be referentially transparent. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
DtY
|
Posted: Thu Jun 18, 2009 9:29 am Post subject: RE:Why Java sucks |
|
|
Those are separate though, but the first isn't a method. Try writing a program that will sit for a while, then read a line from std input. When you run it, enter something while it's just hanging, and it will still get that line. Standard input is just a file, you use the keyboard to write to it, and a method to read from it.
(This may not work in Windows) |
|
|
|
|
|
wtd
|
Posted: Thu Jun 18, 2009 11:01 am Post subject: RE:Why Java sucks |
|
|
Some actual code where this is implemented.
code: | class TEST
create { ANY }
make
feature { ANY }
make is
local
line : STRING
prompt : STRING := "Input something: "
do
std_output.put_string(prompt)
std_input.read_line
line := std_input.last_string
std_output.put_string("You said: " + line)
std_output.put_new_line
end |
|
|
|
|
|
|
rizzix
|
Posted: Thu Jun 18, 2009 12:22 pm Post subject: Re: RE:Why Java sucks |
|
|
Prabhakar Ragde @ Thu Jun 18, 2009 8:20 am wrote: rizzix @ Wed Jun 17, 2009 11:52 pm wrote: By that logic, reading input from the terminal should have two separate methods:
1) Read input from terminal.
2) Return the read input.
Clearly including them both in a single function voids referential transparency.
I/O functions can't be referentially transparent.
You're right, however under CQS style of programming, state mutating functions are separated from those that do not modify state. Hence within a currently mutated state, those non-mutating function are pure and referentially transparent. The only way to achieve that here is to sperate IO into two different methods.
However, I'm just arguing that such an approach breaks atomicity of certain operations (in this case IO) and hence is not the wisest style of programming.
Edit: A better approach to referential transparency is to enforce it through the type system itself. a la Haskell. |
|
|
|
|
|
Analysis Mode
|
Posted: Thu Jun 18, 2009 1:03 pm Post subject: Re: Why Java sucks |
|
|
lol, nice topic.
Java sucks because it's not one of the languages allowed at the IOI. |
|
|
|
|
|
x30Jx
|
Posted: Thu Jun 18, 2009 4:15 pm Post subject: RE:Why Java sucks |
|
|
what the flaming lasers is an IOI?
pardon my n00bage. |
|
|
|
|
|
Analysis Mode
|
Posted: Thu Jun 18, 2009 4:22 pm Post subject: Re: Why Java sucks |
|
|
International Olympiad in Informatics, for high school programmers aroudn teh world.
and in case you're wondering, no, i've never been to the IOI before, i'm nowhere near as 1337h4x. |
|
|
|
|
|
Forumer
|
Posted: Wed Oct 28, 2009 12:38 pm Post subject: RE:Why Java sucks |
|
|
it sucks but its still a good language to begin with |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Prabhakar Ragde
|
Posted: Wed Oct 28, 2009 1:00 pm Post subject: RE:Why Java sucks |
|
|
It's a terrible language to begin with. It should be at least third on anyone's list. |
|
|
|
|
|
bbi5291
|
Posted: Wed Oct 28, 2009 4:13 pm Post subject: Re: Why Java sucks |
|
|
Analysis Mode @ Thu Jun 18, 2009 1:03 pm wrote: lol, nice topic.
Java sucks because it's not one of the languages allowed at the IOI.
This kind of argument will only make everyone else hate us more than they do already. |
|
|
|
|
|
A.J
|
Posted: Wed Oct 28, 2009 6:03 pm Post subject: RE:Why Java sucks |
|
|
By 'us' you are referring to IOI'ers?
damn you guys... |
|
|
|
|
|
bbi5291
|
Posted: Wed Oct 28, 2009 6:30 pm Post subject: Re: Why Java sucks |
|
|
Nope, when I said "we" it included Analysis Mode, so it doesn't specifically mean IOI people.
I meant people who lean strongly toward algorithm coding and away from development. (Language statistics on USACO and TopCoder are very revealing here.) |
|
|
|
|
|
[Gandalf]
|
Posted: Thu Oct 29, 2009 4:28 pm Post subject: RE:Why Java sucks |
|
|
My fellow CompSci.ca posters, get back on topic or move your conversation elsewhere. Thank you.
For the record, I think the qualities of the teacher (whether this be a person, book, or yourself) are far more important than the qualities of the tool (ie. Java). Java won't teach you OOP, and it won't stop you from using lessons learned from FP in your code. It will probably annoy you in the process, but that's a useful experience too. |
|
|
|
|
|
speedyGonzales
|
Posted: Thu Nov 18, 2010 10:13 am Post subject: Re: Why Java sucks |
|
|
Java is excellent language for beginners and about competition programing. While C++ has next_permutation, we have BigInteger so it is up to you to decide which language to choose. If you have problems with TL (time limit) you can switch your code in C++ in order to pass, although core java programmers will prefer to make some optimizations that are almost piece of art. This is the main advantage of C++ coders, the speed of C++.
To post here some code snippets and say i hate java because of that, this is not my way to discuss topics.
Cheers,
the fastest mouse in java. |
|
|
|
|
|
DemonWasp
|
Posted: Thu Nov 18, 2010 2:14 pm Post subject: RE:Why Java sucks |
|
|
Worth noting: Java isn't slow. Please stop promulgating the myth that Java is necessarily slower than C++. There are some (albeit a little contrived) benchmarks that show Java being faster than compiled C++. Most benchmarks show the two languages being approximately the same speed, the difference being far less than the difference between one algorithm and another. |
|
|
|
|
|
|
|