Bookmark Topic Watch Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
T h e  C o d e R a n c h  J o u r n a l - F E B R U A R Y   2 0 2 2   E d i t i o n

* I am sorry, but I got preoccupied with other things, and am late with this Journal. I apologise.
I shall try my hardest not to say anything about what happened on the Ranch in March, but the January Journal was issued early, so I am writing about what happened late in January too.

* A challenge to you: try pronouncing February the way it is spelt, with both Rs. Actually, we don't like R here on the Ranch. People think we are being fussy, but it is really because R is old‑fashioned TXT‑speak shorthand for “are”. People who didn't learn English as a first language will find something like, “R U going 2 the pub 2nite,” difficult to understand, and Google Translate couldn't change that into German until I corrected the abbreviations. So use of text‑speak would make the Ranch worthless for many of its users.

W h a t ' s   N e w?

* The Ranch software has changed little recently, but we continue to work to enhance it in the background. Lots of thanks to those who work hard to maintain this website, particularly Devaka Cooray. We had a glitch a few weeks ago, and the preview box didn't work properly. Fortunately Liutauras Vilda found the problem, and preview is working correctly again. Be sure to use preview, which allows you to see exactly how your post will look in real life, and to correct any spellling and formatting errors before anybody can see them.

* We moderators are still hard at work behind the scenes, and are very proud of this site. We try to inactivate spammers before they can cause any trouble. And we monitor the way our users interact. I must say, our users are interacting well with one another, and the atmosphere is nice and friendly. It is a pleasure to work here.

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

This site isn't anything as busy as a few years ago. But there is always stuff requiring a bit of effort from us, and producing interesting discussions.

* When I started Java®, with JDK1.4.2, we used NumberFormat and its subtypes all the time. They still appear in the Java™ Tutorials, but I haven't used XXXFormat since I discovered Formatter and System.out.printf(). So it came as a bit of a surprise to see an example where NumberFormat worked better: here.

* Here we see a discussion about how to find prime numbers paired to each other, and how to optimise the search.

* Aren't we pleased that the Streams API allows us to “lose” many of the loops we used to write. But beginners still need to know how to write a loop, and to choose the most appropriate kind for the task in hand.  All it takes is an i++; out of place and the program doesn't work correctly. Here, we had to put a lot of effort into correcting that loop.

* How many people have used CodingBat? How many people remember it used to be called JavaBat? It is auseful resource for testing simple algorithms to see whether they work, and I recommend people unfamiliar with it, especially beginners, to try it out. Sai Rama Krishna has been working through CodingBat, starting a thread for each exercise. This one shows how one can find 1, 2, 3 as consecutive elements in an array. We told SRK, “learn from your mistakes” or similar. Was I cruel to post code in the last post of that thread when I knew it wouldn't work correctly?

* 13 used to be called, “Unlucky for some” in Bingo. Was it unlucky for SRK? Well, there was another misplaced i++;, which caused the program to pass all its tests. It had me fooled, but Piet Souris realised there was a corner case, which CodingBat doesn't test for. That program will give an incorrect result for an array like [13, 13, 1]. Later, Junilu Lacar joined the fray, showing how he would tackle the problems with tests, even starting with a solution he knew would fail most of the tests. Start test‑driven development! SRK posted lots of threads like this, and several of us mods showed each other possible solutions to many of them. We posted some solutions, and it interesting to see how much they differ. There are many ways to solve a computing problem, and often many correct solutions!

* Cam Easterly posted his first post here. It is a simple histogram program and works nicely, but we had lots to say about how to improve it. Do you think it is better to use a loop or an array initialiser to populate that array?

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 there are three planned for the rest of March, though the schedule seems to have changed at the last minute. Two books about Git, one by Marco Behler and one by Raju Gandhi, and one by Laurentiu Splica about Starting Spring. Remember not to post questions in the “Welcome” threads, because they will be ineligible for the  book prize.
In case there are any changes, look at our Book Promotion Schedule.

Congratulations to all the book winners from Late January and February, the books being,
Rust Web Development by Bastian Gruber,
Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 by Kishori Sharan & Adam L Davis,
Patterns and Practices for Infrastructure as Code by Rosemary Wang, and,
Designing Hexagonal Architecture with Java: An architect's guide to building maintainable and change-tolerant applications with Java and Quarkus by Davi Vieira.

Thank you so much 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

* We are grateful to publishers who support us with book promotions. Manning, Packt, O'Reilly and Apress are amongst those who provided books recently. How many poeple find the Streams API scary? A long time ago, I got a copy of Modern Java in Action, or its earlier edition, by Urma, Fusco, and Mycroft at Cambridge. Unlike most “In Action” books, this one starts off gently from the very basics, which were new to
99.9% of developers back in 2014. It explains Streams, λs and Collectors very gently, Other parts of the book look at Modules, advances to threading with fork‑join and CompletableFuture, and whether Optional is a complete alternative to null. And there's more. Even though the book is about 5 years old, I think it is still a good buy and a very good introduction to “Modern” Java.

* 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

Twitter -
Facebook - Our FB account has been quiet for a while, but there are book promo notifications on Twitter.

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

In a previous journal, I said, “I used to do some teaching, and encouraged the students to use pencil and paper.” I used to stand opposite the students, facing them, at least those who were awake. I had to learn to read their work upside‑down, and had to write corrections upside‑down, too! It would have been cruel to use the usual orientation; then nobody can read my writing! Of course I used a pencil

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.
You guys haven't done this much, have ya? I suggest you study this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic