T h e C o d e R a n c h J o u r n a l - M A Y 2 0 2 1 E d i t i o n
Have all the
CodeRanch staff disappeared? If the weather is anything like round here today, they are all hiding under parasols with a drink. Pour yourself a drink and read the Journal.
W h a t ' s N e w?
* The Ranch software has changed little in recently, but our Forums front page is changing. The old “recent forums” page will be removed some time and we shall have to look at the forums home page to find them. It is possible to go to your profile and under “site personalisation”, click the “Default view on the home page”, and choose which of the ten ten options you would prefer. You can also change the view temporarily with a dropdown list at the upper right of the forums page, and the "change view" button.
I n t e r e s t i n g C o d e R a n c h F o r u m P o s t s
We haven't been quite as busy as the last time I edited the Journal, but there has been some interesting stuff.
* Do method references and lambda expressions behave the same? Of course they do . . . until you read
this thread, which started back in the Winter and was reactivated earlier this month. There is a difference. A method reference captures the value of a local variable as it was when the method reference was created and a lambda captures the current value, or maybe it is the other way round. I was confused by the code myself. I think “the other way round” is correct. I don't want you to be mistaken, so read Rob Spoor's post in that
thread and you can be sure about it. And remember that the old
Java buzzwords included “simple”. The idea was that a programmer could readily remember the rules without having to look them up. Is the rule about method references “simple”?
*
This thread is hot off the presses, only just squeezing into May by a matter of hours. It is very short and sweet, five posts at the time of writing, but it reminds us that sometimes A and a are different and sometimes they count as the same.
* We all know that Scanners and BufferedReaders can be used to read text files, but have I got the wrong end of the stick about them? Does
this thread explain why my text file sometimes had three lines and sometimes had four lines? Carey Brown found that Scanner uses
$ for a regular expression meaning end of line. Does that help us understand how the two work?
* If you download a double from a database, can you display it to 21 digits? Or is that impossible? Answer in
this thread.
* You can confuse yourself with
Math.random() and you can confuse yourself with incorrect indentation. Have a look how far the OP in
here managed to sort out those problems.
* Several threads by the same person, which I merged into one. How do you sort
cards? What happens if you use Strings to represent
Cards, e.g.
"KS" = King of Spades? What about the example in the Java® Language Specification, which uses
enums for the rank and suit? I think that is a more object-oriented design. Should the OP change his design? Look
here and decide for yourself.
To the OPs: thank you for your quality posts, you all will be rewarded with a well-deserved
cow!
B o o k P r o m o t i o n s
CodeRanch tries to put on book promotions every week, and we have two planned for June so far, both Spring books published by Apress. Davis'
Spring Quick Reference Guide, and Deinum & Cosmina's
Pro Spring MVC with WebFlux. Maybe there will be more later in the month. Try your luck to win the books; go to the Spring forum and ask a question. Any posts, indeed, except “welcome” posts, are eligible for the draw. In case there are any changes, look at our
Book Promotion Schedule
The last book promo from April reached just into May:
Felienne Hermans' the Programmer's Brain.
There was one ordinary book in May:
Rafael del Nero's Java Challengers.
The other threee promos were for “live projects”, a rather new concept:
Laurentiu Splica's about Spring Security,
Kim Falk's about an ML Recommender System, and
Ana Bell's about Manipulating Data.
Congratulations to all the book winners.
We are very grateful to the publishers and authors for supplying the books and answering our questions.
B o o k R e v i e w s
* We have a dedicated
forum for book reviews.
Please check out the latest reviews (also available on our book review grid:
Book-Review-Grid)
B o o k S a l e s
* Anybody fancy learning how to do matrix multiplication? Or how to locate places in 3D space? These are both things one might need to know for any graphics programming. You might need calculus to follow things moving, or function fitting as a first stage of machine learning. All these are to be found in Paul Orland's book
Math for Programmers. It is a really clear read and starts from a very basic level, but doesn't shy away from difficult topics.
* Sign up to some of the publishers' websites because they frequently offer short term discounts.
T h e M o o s e o n S o c i a l
You will find a few recent CodeRanch announcements and quotes at:
Twitter -
https://twitter.com/coderanch
Facebook -
https://www.facebook.com/coderanch Our FB account has been quiet for a while.
Follow / Like us so you don't miss a thing.
A b o u t T h e E d i t o r
Campbell Ritchie
I used to be reluctant to have anything to do with the Journal. I thought I wasn't enough of a literary chap. But this is now the third time I have edited it, and I am coming to enjoy it. So, you have got me again. And I hope I shall be back some time with pencil and paper to produce another Journal. I seem to have had lots to do last week, so sorry if I am late with this Journal.
I used to do some teaching, and encouraged the students to use pencil and paper, and carried a large eraser which looked as if it would do a student serious harm if I threw it at them. Not only does programming entail a lot of planning and thinking before coding anything, but it also entails
destroying the evidence deleting whatever doesn't work to make way for something correct!
S u g g e s t i o n s / F e e d b a c k
If you have any feedback on this month's journal then feel free to create a topic in our
Ranch Office
J o u r n a l A r c h i v e
Our previously published journals are available online at
JavaRanch Journal