On Writing Transitioning to Java, My First Book

My first book.

I decided to write a book. What academic has not thought about doing this. I spent 31 years teaching programming starting with Pascal and then through my career C, C++, Perl, PHP, and finally Java. There have been other languages I used before I became an instructor. The most lucrative contract I ever had involved writing in PL/1 on an IBM-PC running DOS 3.3. I don’t think there is a market for PL/1 books, and it was over 40 years ago that I used it. The logical choice for a book was Java.

Having taught students in the first year of their studies and then specializing in the final year project courses I decided to write a beginner’s book. I have strong opinions on learning to program and on the Java language. I even wrote a sample chapter that you will find two stories back in this blog. Time to speak to publishers.

I had met a representative from O’Reilly and had email contacts at Apress and Packt. The response from O’Reilly and echoed by Apress and Packt was that they had enough beginner’s books. Apress did come back after rejecting my book idea and asked if I could do a video tutorial for beginners. I said yes, I completed it in 6 weeks, and you can watch it, if you have a subscription, at https://link.springer.com/video/10.1007/978-1-4842-8614-2.

My meeting from Packt was a little different from O’Reilly and Apress. While the turned down my beginner’s book they encouraged me to come up with another proposal. During our discussions, I came up with the idea of a beginner’s book for experts. Developers today are typically fluent in several languages. If they found themselves needing to look after a Java code base or had a requirement for a solution to be written in Java, what resources could they turn to. I did not think they needed a book that explained what a compiler is, what a variable is, or what a loop is for.

Instead, I proposed, after our discussions, a book aimed at developers with experience with any imperative language. From what I could tell, based on admittedly very little research, such a category of book, expert new learner’s book, was near unique. Packt must have thought so too because they asked me to go ahead with an outline for the book.

The first outline consisted of 10 chapters and 200 pages. In moving from an informal to a formal proposal, the book grew to 13 chapters and 250 pages. Now that, as it felt, my bluff was called I was concerned I could not write that much. Despite my concerns about my ability to write the book, a deal was struck, an advance on royalties agreed to, and a contract was signed. The official start of writing was May 2022 with completion in December 2022.

As each chapter was written it was sent to the editorial team responsible for my book. I remember that after sending the first chapter I was worried they would cancel the contract. Instead, the feedback was positive with numerous minor grammar and style issues that I needed to resolve. As I progressed, I know that I was learning how to write a book as the number of editorial comments became fewer and fewer.

This is also when the next expansion of the book occurred. While writing about the structure and syntax of the language I realized I had more to say than I thought I did. This quickly added three more chapters. It was four but the last section of the book on packaging applications went from two to one chapter. This is when I discovered that writing the text was only half the work.

I learn by tinkering with and modifying existing code. Therefore, it was important that every chapter had code to work with. I discovered that preparing the code was far more time consuming than I imagined. I had to be certain that every line of code, no matter how simple, was professional. I also made the decision that while a reader could use any IDE they wanted, the book was presented with just a text editor, a JDK, and the Maven build tool. For an exploration of Jakarta server-side coding I just added the GlassFish server. The three main IDEs were presented but I did not want to fill the book with instructions on how to use NetBeans, Eclipse, or IntelliJ.

During the writing process chapters were also reviewed by a technical reviewer or TR. One was selected by Packt and one recommended by me. I asked Robert Scholte to be my TR after he kindly answered a question I posted on Twitter concerning Maven. He accepted my request. So now not only was I worried about the editorial review, but I was also now terrified of the technical review. I should not have been. Both Robert and the Packet TR, Massimiliano Dessì, made constructive suggestions that resulted in a better book. My concern that a TR comment might begin with “What the f#ck do you mean in this chapter” was unfounded.

I cannot say that I worked every day on the book. Hindsight suggests I should have. Still, the team at Packt were both supportive and patient with me. When grammar or style changes were requested, I always deferred to them. After all, they were the professionals while I was just an amateur writer. On the very few occasions when I was questioned by a TR about what I wrote, I found that I could either accept that a change was necessary, or I could explain why my presentation was indeed correct.

It is now a year from when I started. This means the book took more than the projected 8 months. It is done and as I write this on April 23, the official publication date is April 28. It was harder to write than I imagined. You may think an author knows everything on their topic but in my case, I learned a lot. I learned how to write for a book, how to code for a book, and learned the small details that an experienced programmer coming from another language needs to know.

To my team at Packt a big thank you for the support. They are:

Publishing Product Manager: Kunal Sawant

Senior Editor: Rohit Singh

Technical Editor: Pradeep Sahu

Copy Editor: Safis Editing

Project Coordinator: Prajakta Naik

Proofreader: Safis Editing

Indexer: Manju Arasan

Production Designer: Shyam Sundar Korumilli

Developer Relations Marketing Executives: Sonia Chauhan and Rayyan Khan

Business Development Executive: Kriti Sharma

And of course, my TRs, Massimiliano Dessì and Robert Scholte.

All that is left is to tell you that book, Transitioning to Java ISBN 978-1-80461-401-3 is available at Amazon, Barnes and Noble, Packt and possibly more book sellers. An E-book is also available. All the book’s source code can be found at https://github.com/PacktPublishing/Transitioning-to-Java. Please buy the book or recommend it to friends or co-workers should you or they need to learn Java in the time it takes to read the book.

Remember the 10 chapters and 200 pages? The finished book is 16 chapters and 330 pages. I could have written more.

Ken Fogel

April, 2023

JCP Executive Committee Meeting – Singapore April 2023

I first ran for a seat on the JCP EC because I was concerned about how Java was losing relevance in education. The JCP Java in Education initiative was started to improve Java’s place in schools. When I was first elected by my peers to the JCP EC, one of the perks of being a member of this committee was the two face-to-face meetings held each year. One was typically in North America and the other in Asia. The only problem with this was that I was first elected in November 2019. I had my plane and hotel reservation for Singapore all in place for the April 2020 meeting. Well, you all know what happened. Luckily everything was cancellable.

My first term was for one year as I was replacing an associate member who left the EC because of a change in employment. I ran again in the November 2020 elections and was reelected to a two-year term as an associate member. An associate member represents the independent members who are members of the Java Community Process. Well, you all know that what happened in 2019 through to 2020 continued into 2021 and 2022.

In November 2022 I was elected to a third term on the Executive Committee. I am writing this blog at 9753 meters in the air on the first leg of my return flight from Singapore on April 14. The meeting happened in 2023! The remainder of this blog is a summary of what occurred, all very good, during the four days I was in Singapore. Please do not misunderstand me, I did not run for election to the JCP EC for the trips. They were just icing on the cake.

Normally you get on a plane, sit for a few hours, and get somewhere. This trip was a little different. To get to the meeting I needed to take 3 flights. I left Montreal on April 8th and some 32 hours later, including layovers, I arrived at 7 AM on April 10th. Crossing the International Date Line added a day on my calendar. The return flight I am on now left at 9 AM on April 14 and will arrive in Montreal at 11:45 PM the same day. What the International Date Line added was subtracted but still the same 32 hours of travel time. The times I mention are the local time I left and then the local time I arrived.

It was a difficult transit for me. My first flight was for 4 ½ hours to Denver, Colorado. There was an almost 3-hour layover in Denver, and it will be almost 4 hours on the way back. All started well in Denver. We boarded the plane on time but just as we were waiting to leave the gate for the runway the captain announced that the Denver airport was closed to all flights. The FAA detected microbursts, a weather condition that could be a danger to the plane. So, we sat for about 45 minutes before the plane left the gate to join the queue of planes waiting to leave. In another half hour we were in the air.

When we disembarked from the plane in San Francisco it was already 10 minutes past the start of boarding for the last leg. Fortunately, after a jog across the airport to get to the gate, I arrived to find that boarding had not begun. This gave me a few minutes to refresh myself before I boarded this flight. Now the real adventure or misery began. The SFO to SIN flight was 17 hours. I had already been in the air for 7 hours. If you are doing the math, the flight time came to about 24 hours. Arriving at the airport 3 hours ahead of the flight and the layover in Denver, the 45 minutes I was in SF, added the extra hours is how I measure the travel time.

A few words about a 17-hour flight. It is about as miserable as a flight could be. I am not talking about the flight staff, they were wonderful. The plane, a Boeing 787 Dreamliner, had a little more legroom in steerage, I mean economy, than the 757 and A-220 planes I took to get to SF. A flight attendant told me that she prefers the 787 because it is pressurized to 6,000 rather than 10,000 feet. Sitting in a plane for that long is not an experience you should long for. I did try to sleep and suspect I did for about an hour and a half. My sleep pattern is very much like toy dolls that close their eyes when they are laid down. I am the same way, I lie down, close my eyes, and almost always fall right asleep. I could not achieve restful sleep sitting up.

Despite the discomfort I arrived In Singapore on April 10th running on the excitement of the trip, and happy to get off the plane. My accommodations were at the Hilton Garden Inn in the Little India section of the city. I arrived at the hotel 3 hours before check in time but fortunately there was a room available right away. The room also came with breakfast every morning. It was buffet style with a good breakfast selection. I rate it highly because they had lots of bacon cooked the way I like it.

On the first day I decided to explore the neighborhood around the hotel before napping. As I already said, the hotel was in Little India. I did a little exploring but the experience of high humidity with a temperature of 34 Celsius was quite uncomfortable. I decided after walking a few blocks to return to the hotel. There was a restaurant on the grounds of the hotel that was air conditioned, so I had lunch there. I ordered a dish with 2 vegetable Samosas and a small bowl of chickpeas in a delightful and spicey sauce. Indian cuisine has always been my favorite and it was delicious. After the meal I returned to the room, set an alarm, and took a three-hour nap.

I awoke to a case of heartburn that I quickly put out with some antacids. To me this was more proof that my meal was excellent despite what my stomach may have decided. That afternoon another member of the JCP, Rafael del Nero of SouJava, arrived at the same hotel. He arrived from Dublin. We did a bit of exploring after he arrived. The taxi driver he had from the airport recommended an area, I’d call it an outdoor food mall, within walking distance of the hotel. I had a sweet and sour chicken dish with rice and Rafael had a Chillie Crab. He needed instructions on how to eat it. We both enjoyed our meals and returned to the hotel. I stayed up another hour and went to bed.

I was going to bed at 10 PM Singapore time. My body was confused as it thought it was 10 AM. Despite this I slept till about 6 AM. I met Rafael for breakfast and then we headed off to the day’s planned activity. We were visiting the offices of Oracle where three university professors and a student leader of the local Java User Group came to talk about Java in Education. It began with presentations from Oracle. First Georges Saab, Senior Vice President of Development Java Platform Group spoke, and he was followed by a presentation on a typical day of an Oracle developer. We ended with a discussion with the professors about their use of Java.

When our meeting ended, a third member of the JCP who was staying at our hotel, Mala Gupta of JetBrains, joined Rafael and myself for some sightseeing. We quickly agreed that a visit to the Marina Bay Sands Hotel was what we wanted to do. This is a famous hotel with three 56 story towers topped with a deck, shaped a little like a boat that extended across all three towers. The front of the boat on the first tower was a general observation deck that for $26 you could visit. The remainder of the deck was just available to guests of the hotel that included a pool and restaurants. The hotel is close to the harbor, and this gave it an excellent view of the city. We must have spent close to two hours up there before we returned to the hotel.

After freshening up back at the hotel we went looking for food. We came across an Indian and Nepalese restaurant. A favorite restaurant some years back in Montreal had Nepalese cuisine so I was excited to be reacquainted with it. While Rafael enjoyed his dish, Mala, who hails from New Delhi, and I were disappointed. We could not finish our meals. I felt so bad about the food there, I paid the bill. The plan was to return to our rooms and then go out again for supper. Mala, who had just arrived that morning, decided not to join us.

When I got to the room a wave of exhaustion, likely because of the time difference, overcame me and I messaged Rafael that I was not up to another meal. He responded by agreeing that he was not hungry, but he wanted to visit the Chinese section of the city. I didn’t travel to the other side of the planet to hang out in my hotel room so I replied that I would join him. At 8 PM we called a Grab, the local equivalent to Uber, and went to the Chinese district.

What we discovered was an area that, like Little India, had numerous shops and even more numerous restaurants and food kiosks. The difference, of course, was the motifs. After we wandered around for a while we returned to the hotel. While we took a Grab to get there, we decided to walk back to the hotel. It gave us an opportunity to see a bit more of the city.

The next day, Wednesday, was the official JCP EC meeting. The meeting was held at the offices of Alibaba. We heard presentations on the direction of Java. I am very excited about what I heard regarding changes that, while having little or no effect on existing coding practices, will greatly simplify the learning of the language for beginners. There has been a concern in the Java community about Python replacing Java in many schools. I believe that the changes we heard about can make Java as friendly as Python. We just must get the word out that the current and upcoming versions of Java should make Java a serious contender, again, for students at primary schools, secondary schools, and universities.

After the meetings the three of us returned to the hotel to freshen up and then joined everyone for a traditional meal at a restaurant called True Blue. Rather than each of us ordering our own meal, all the dishes on the menu were brought to the table. It reminded me of a tapas style meal where you get several dishes that you can taste. The food was interesting with some hits and some misses for my Canadian taste buds. After the meal some of went to a bar. A better description is a bar mall. In a modern mall-like setting there were numerous bars. No ambiance to soak up but we engaged in some lively conversation and got a chance to know each other better. I also had my second beer of 2023, my first was the day before.

The final day, Thursday, had two events scheduled. The first was a visit to a university to meet students. It began with a panel discussion on Java and working as a developer. It was followed by a presentation I gave on some of the new features in Java and how you can use Java to do machine learning. It was the Artificial Intelligence/Machine Learning, AI/ML part of my presentation that most interested the students and even their professors. As one on the slide read “You can program AI/ML in any language as long as it’s Python” I demonstrated to these students that Java can be as easy or possibly easier than Python for someone wishing to explore AI/ML.

The language Python is popular in this space because most AI/ML libraries are written in C/C++ and Python easily interfaces with these libraries. It is rare that an AI/ML framework is written in Python. This makes Python the go to language for this work. I demonstrated a Java framework called JSR-381 VisRec. It provides a standard interface to any AI/ML code written in Java rather than C. At its most basic you need just one line of code to train a system and one line of code to use a trained system.

An enhancement to Java will simplify Java’s ability to interact with C/C++ libraries almost as easily as Python does is coming shortly. Using a picture of my dog, a Shetland Sheepdog named Willow, along with two hundred other photos of Shelties and 200 images of dogs that were Not Shelties that were used to train the model, I demonstrated a weakness in ML due to the quality of training images. The students had already told us that most only used Python in their courses. When I presented upcoming simplifications to Java along with the simplicity of ML, I believe we changed their opinion of Java. We just need to get the word out that it is not your mother’s Java anymore.

From there we returned to the hotel to prepare for a mini conference put on by the Singapore Java Users’ Group in a conference amphitheater in another part of the city. We were flattered that they called it the Java Heroes Conference. We began with a panel discussion and then there were three technical presentations by members of the JCP. After the first presentation we paused for a supper of pizza. It was during supper that several JUG members asked to take selfies with us. I think of that as the modern autograph.

I was beginning to feel the effects of the trip. After the pizza and during the first after pizza presentation  I found myself falling asleep. I decided to return to the hotel early as I still had to pack and get ready for today’s return home. As I write this, I see that we just passed Tokyo, just another 8 ½ hours to San Francisco.

This has been, except for the travelling, an amazing experience. I’ve travelled to the other side of the world and met members of the JCP I have only seen on Zoom. Speaking to students, something I have not done in almost two years since I retired, was a lot of fun. Those who know me will tell you that I tend to perform rather than lecture and I enjoy doing that. I hope to have more opportunities as a guest speaker at student events in the future.

I’ll end with a plug for my upcoming book. It is called Transitioning to Java, a beginner’s book for experts, that will be officially published on May 5th. This is a book for programmers with little or no experience with Java who find themselves needing to understand the language in the time it takes to read a book. While waiting for the flight this morning I chatted with a young man who worked in IT. He obviously knew what Java is, but his training was in C/C++. When we talked about how Java remains as relevant as ever and that some cool stuff is coming down the pipeline, he asked me for the book’s title and my name and assured me he will buy a copy. That makes one copy that may be sold.

Ken Fogel

April 14, 2023