Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: markspace Newsgroups: comp.lang.java.programmer Subject: Re: The Assignment Principle Date: Sun, 26 Jan 2014 14:27:13 -0800 Organization: A noiseless patient Spider Lines: 39 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 26 Jan 2014 22:27:16 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="5aa64ebf9a53573f97c75abba936b0e2"; logging-data="16208"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ugOjsMPdtBnB6sxYyqt9NFnVUAgdXrjs=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: Cancel-Lock: sha1:AGHjhJxFCEXnuvsD0IvWtLuXy7U= Xref: csiph.com comp.lang.java.programmer:27403 On 1/26/2014 12:17 PM, Stefan Ram wrote: > Also, it is > about values and not expressions, so that > > v = java.lang.Math.random(); Well, most often it is about expressions: a = 2; b = 1; v = a * a + b; System.out.println( v == 5 ); Had darn well better print 'true'; Math.random() is kind of an exception, as well as NaN, which has its own semantics for comparisons. It's fair to point out that objects have states, and method invocation often returns different values based on their internal state. InputStream in = ... v = in.read(); Is going to return a different value for each invocation, generally speaking. We're getting into the difference between traditional languages, which do have state, and functional languages, which try to avoid mutable state whenever possible. Functional languages try to mimic the behavior of algebra and mathematics, so that's why they look a lot closer the mathematical formulas and properties you are used to from that field. But Java isn't functional programming, and those properties you learned for algebra aren't going to always work here. Thus, learning Java involves learning a new set of rules, not trying to make Java work like the other set of rules.