Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

Charles O'Leary

Ranch Hand
+ Follow
since Jul 10, 2014
Cows and Likes
Cows
Total received
9
In last 30 days
0
Total given
0
Likes
Total received
80
Received in last 30 days
0
Total given
72
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Charles O'Leary

Hello Adam,

Congratulations on your new book release.  Does the book discuss which features may be sticking around for the upcoming Spring 6?
4 months ago

Yeason Ortiz wrote:Why is the following line of code not compiling ?

float value = 102.0; // DOES NOT COMPILE

Boyarsky, Jeanne; Selikoff, Scott. OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide (p. xl). Wiley. Kindle Edition.


A float cannot store a (default) double without an explicit cast.

... and Welcome to the Ranch!

Campbell Ritchie wrote:

Charles O'Leary wrote:. . .  I struggled with applying those principles to programming in a meaningful way . . .

So did I. So did all the other experienceed people here on CodeRanch. We were all beginners once, and we all struggled, maybe with different things.



Campbell,

So I wasn't the only one to attempt to apply "Moonwalking with Einstein: The Art and Science of Remembering Everything" techniques to programming?  Were there any particular things that you have found thus far, that have helped you personally?
5 months ago

Campbell Ritchie wrote:

Charles O'Leary wrote:. . .  I struggled with applying those principles to programming in a meaningful way . . .

So did I. So did all the other experienceed people here on CodeRanch. We were all beginners once, and we all struggled, maybe with different things.


That's really reassuring and all the more reason why I look forward to Felienne's new book.  Thanks Campbell!

Felienne Hermans wrote:yes that sounds about right! It is basically an introduction to cognitive science book for programmers


Thanks Felienne!
5 months ago
It sounds as if this is a "Moonwalking with Einstein: The Art and Science of Remembering Everything"-like book tailored to programmers?  I struggled with applying those principles to programming in a meaningful way (especially one that could allow those memories to be very quickly accessed within the confines of let's say a 90 minute Java 11 real or mock certification exam).  So, I really look forward to your new book release.  Thanks for taking on this work.
5 months ago
Are there certain languages (Java, NoSQL, Fortran, HTML, CSS, JQuery, Kotlin, etc.) where the book's information may be more pertinent?
6 months ago

Juraj Valkucak wrote:* very little time

Oracle, how many MORE people have to post something like this for you to adjust the time?

Congrats Juraj!

jay java wrote:Under chapter 22, under subtitle “MAKING THE CONSTRUCTOR PRIVATE”, I saw following code:



Should this method have word static?


Welcome to the Ranch!

I think that is in the errata? here

Mike Simmons wrote:

Charles O'Leary wrote:

Radhika Ganesan wrote:Reference 1 - Page 179 - Last Paragraph - "Concatenation is like calling a method and results in a new String".


string1 + string2 is equivalent to string1.concat(string2)


Unless you are talking about whether they result in a new String, or a reference to a preexisting String in the pool. Then, they may be different.  A + operator can be part of a compile-time constant expression, ir the operands are also constants or constant expressions.  But once you include a method call like concat(), it cannot be part of a compile-time expression.  See Campbell's link for details.

I would also note that the book quote has a mistake.


My focus was on the word "like"... so I'll alter that to "string1 + string2 is like  string1.concat(string2)"  And also thanks for pointing out the Errata Mike and Jesse!
Radhika,
Put simply, the most important point here is timing.  At the point of evaluating "==",  can both operands on the left and right be found in the string pool?

Radhika Ganesan wrote:Why is the code printing true at one instance


able to match "rat1" with "rat1" from the string pool

and other false in the other ?


not able to match "Hello world" with "Hello " and "world" from the string pool. You did notice interning can help with this, depending upon the requirement.

Radhika Ganesan wrote:Reference 1 - Page 179 - Last Paragraph - "Concatenation is like calling a method and results in a new String".


string1 + string2 is equivalent to string1.concat(string2)

Radhika Ganesan wrote:I wrote a sample code by adding str in switch case statement and also checking == on two strings created using "+". It does seem that "+" is compile time. If so, what does Reference 1 mean ?



Secondly, operators, like "+" are operators.  They cannot be classified as runtime or compile time.  The operands, however, maybe classified as runtime or compile time based upon the compiler's ability or not to determine value(s).

I hope that helps.
For those that don't have the book, I was looking for an equivalent visual to the unrelated attached, if possible.  

However, it's likely that Tim has just answered this question?

Ankit Garg wrote:I can probably annotate each line if that helps


That wonderful explanation was (also) provided in the book.  However, I was looking for something more visually supplemental.
Hi Ranchers,

Does anyone know how this (static/hidden/variable) answer would look (like) in memory and/or point me to a similar fully illustrated/diagram/picture example? (There's an unrelated Figure 8.4 in the book that I ideally wanted to model this after so that I can accurately work through these types of problems faster.)  

Question is from Sysbex CSG page 361 #22.  


Thanks!