Summer Reading 2023

View from a beach restaurant

I'm about to jet off on my sunny* summer holidays, so it's a good time to leave you with my recommended reading and learning. Are they all my books and content? Yes. But I do have discounts and deals for them, so that's something, right?

Working With Code in IntelliJ IDEA (Online course)

I've just released a Brand New online course on LeanPub, Working With Code in IntelliJ IDEA. If you want to step through the most helpful features for writing code with IntelliJ IDEA, this is the course for you. We have a special introductory price if you click on this link: https://leanpub.com/c/workingwithcodeinintellijidea/c/eBRBFWYIyek8.

If you're already a subscriber (reader or author) of Leanpub, it's available to you for free.

If not, but you already own the IntelliJ IDEA book, I can give you a link to get the course for free, contact me.

Getting to Know IntelliJ IDEA (PDF, eBook & paperback)

If you follow me on Twitter, or literally anywhere else, you'll know that Helen Scott and I released this book on IntelliJ IDEA at the end of last year. We're currently doing a limited-time-only offer where if you buy the book, you get access to our first IntelliJ IDEA course, Working With Code in IntelliJ IDEA, for free. You have to buy it before 6th August to qualify. Do it now!

If you want an e-version (eBook or PDF), I recommend getting it directly from Leanpub. It's also going to be much easier for me to confirm your purchase in order for me to issue you a discount.

If you want the paperback version (and let's be honest, it's nice to have these things physically in your hands at times) it's available on Amazon.

After you've bought the book, contact me and I'll give you a link to get the course for free.

Descubre IntelliJ IDEA

The IntelliJ IDEA book is also available in Spanish. It's feature-complete, we're just working through all the feedback from reviewers. While we're still doing that process, you can get the book at a discounted price on Leanpub. We also welcome feedback from readers.

Head First Java (Third Edition) & 97 Things Every Java Programmer Should Know

Head First Java is, of course, a classic, which is why I jumped at the chance to help update it to its current third edition. This version covers features all the way up to Java 17, so even if you're a Java expert, there will be some new stuff in here for you. I also modernised the concurrency chapter and added so much modern concurrency stuff that we had to split it into two chapters.

97 Things Every Java Programmer Should Know was released in 2020, and with everything else that was going on at the time I didn't really talk as much about this book as I would have done. I'm very proud to have been able to edit this and for this to be the first book that had my name on the front cover. It's got a huge number of tips and wisdom in it, whatever stage you're at in your career, there's something in there for you.

I have a link for a 30-day free trial for O'Reilly Learning. If you sign up with this link, you can read these two books for free: https://learning.oreilly.com/get-learning/?code=HFJAVA21. You just have to finish the books in 30 days!

Modern Software Engineering - David Farley

At last! A book I didn't write! Although... Dave did very kindly ask me to write the foreword, which I was very excited to do because I loved this book so much. I read this book in less than a week when I was on summer vacation back in 2021, and I highly recommend it as summer reading. It covers a whole bunch of topics that qualify as "Software Engineering", but it's not stuffy or academic, and Dave's writing style makes it clear why these things matter. You can buy it on Amazon, or, if you used the 30 day free trial above, you can read it on O'Reilly Learning.

O'Reilly Playlist

Oh OK, I should recommend some other stuff I didn't write. I actually curated an "Expert Playlist" on the O'Reilly platform called Becoming a Better Programmer. So, you can use the 30-day free trial link to check out that playlist.

More Learning

I'm hosting my first online training for Gradle next week. I'll be teaching Gradle Enterprise for Developers. Note that this is not about the Gradle build tool. In fact, Gradle Enterprise works for Gradle and Maven, and also has functionality for Bazel. You can attend virtually to find out more.

I'm also presenting at the Manchester Java User Group and the London Java Community in August, and Madrid Java User Group in September. If you're local to any of those areas, keep an eye on those websites and sign up when my events are published.

And Finally

As you can see from this blog, I have quite a few projects and ideas in progress or brewing. I've been investigating using substack to publish news and updates. There's nothing there right at this second, but if you are interested in receiving news about new or updated books, courses, events, and even blog posts, subscribe here.

Happy summer learning!

* I'm going to England. It's definitely not going to be sunny.

Writing A Book Is Hard

Getting to Know IntelliJ IDEA book cover

Hey Helen, I know you were disappointed you missed out on a chance to contribute to 97 Things Every Java Programmer Should Know, do you want to write a book with me?

Trisha Gee, Spring 2020

That's how it started.

It's that easy.

[Maniacal laughter in the background]

I have long wanted to write a book. It didn't really matter what type of book (novel, technical) or on which topic (I have opinions on everything). I wanted My Name On The Front Of A Book. I wanted to be An Author. I knew Helen also wanted to be An Author, and that by working together we could keep each other accountable and actually do this.

Continue reading "Writing A Book Is Hard"

Upgrading a Maven, Spring Boot and JavaFX application

I've been migrating all my JavaFX applications to Java 15 / JavaFX 15.0.1 to see if there are any pain points or gotchas to be aware of. I particularly wanted to understand how Maven and Gradle handle JavaFX, and how to successfully build and run the applications in IntelliJ IDEA.

In this blog post I explore the steps taking to upgrade a Spring Boot/Maven/JavaFX application.

Continue reading "Upgrading a Maven, Spring Boot and JavaFX application"

New IntelliJ Tricks I Learnt Part 2

Apparently, I’m all about Continuous Learning - after I wrote the last post about IntelliJ Tips, I carried on through my trawl of the documentation and, of course, discovered a load more things I didn’t know. And this is all just in the Quick Start section!

So here’s the next batch (although once again I’m not sure how many are only applicable to IntelliJ 14). All shortcuts are for Windows unless otherwise stated, and Mac users should be able to replace the Ctrl key with Cmd in all these cases.

Navigate between methods

Now I knew you could use the structure thingie (Ctrl+F12) to let you navigate to methods in your class (although I never actually use it, it somehow never sticks in my head). What I did not know is that you can jump between methods using Alt+Up/Down arrows. This strikes me as being super useful, especially to browse tests.

Refactoring String Fragments

I’ve wanted this feature so many times, but could never find it or get it to work - did you know you can refactor out parts of a hardcoded string into variable/field/constant? Select the section of the String you want to extract, and use the normal “Extract…” shortcuts - e.g. Ctrl+Alt+V to extract it into a variable.

I’m sure I’ve tried this before and it didn’t work. But I’ve tested it and it does!

Invert Boolean

There doesn’t seem to be a keyboard shortcut mapped by default, but using “Refactor -> Invert Boolean…” (or using our newly discovered “Navigate to Action” shortcut of Shift+Ctrl+A and typing “Invert”) you can tell IntelliJ you want a boolean field to mean the opposite thing, and it will flip the meaning everywhere. For example, you might have an saved flag, and you now want it to mean notSaved - IntelliJ will make sure the isSaved method returns !notSaved.

Magic Refactor Suggestions

You don’t always know exactly what refactoring operation you want to perform, and IntelliJ is ready to help - it can suggest refactorings available in the current context using the catchy magic incantation Ctrl+Shift+Alt+T. Seems useful, but I’m pretty sure I’m not going to remember that one.

Highlight implemented/overridden methods

I love everything about IntelliJ’s ability to find usages of things - finding where methods are called, finding implementations of a method, highlighting usages of a field, method or variable… What I didn’t know, is that you can highlight the methods that implement or override a specific interface or superclass. For some people, this might not add much, as your little “I override something” icon

"Overrides

combined with the @Override annotation, might tell you all you need to know. But that only really works if you’re implementing a a single interface. If you’ve correctly separated your concerns, you might implement several interfaces, and want to know which are the methods from a particular one. That’s where Shift+Ctrl+F7 on the “extends” keyword comes in handy.

Run individual inspection by name

I use inspections quite a lot. They’re especially useful if you have a codebase that doesn’t quite conform to your ideal standards, so you can’t yet turn on automated checks like checkstyle to break the build when the code doesn’t conform - there’s an initial step where first you need to clean up the code. Inspections are great, because you can have IntelliJ give you little yellow marks to show where things are suboptimal, and aim to check in only files without little yellow marks.

What I didn’t know, is that you can run a single inspection on files in any scope. So if, for example, you wanted to make sure that the code you’ve touched in this change has no unused bits, like unused parameters or unused/untested methods, you could press Shift+Alt+Ctrl+I and type “unused”. Select the “Unused Declaration” inspection and choose to run this on all uncommitted files. This will tell you where you can clean up your code, and every commit should make your codebase that little bit better.

Saving Power With Highlighting

I did not know you could easily alter the active errors/warnings, and use that to save power. Quite Interesting.

Auto indent your lines

I almost obsessively reformat my code as I go, pressing Ctrl+Alt+L almost like a muscle twitch. What I’ve just discovered, though, is that there’s a shortcut which will just fix the line indentation, which is probably 80% of what I need anyway - Ctrl+Alt+I.

Fix Evil String Concatenation

I can’t believe I didn’t notice this one earlier - do you know how many times I’ve gone around and manually changed:

System.out.println("This thing " + something + " is " + somethingElse); 

to

System.out.printf("This thing %s is %s%n", something, somethingElse); 

Do you??? Anyway you don’t need to - Alt+Enter inside the params will suggest the replacement and do it for you. Nice.

VCS Quick Access

One of the areas where I definitely don’t use IntelliJ to the best of its abilities is the Git integration. I’ve been using SourceTree combined with IntelliJ to do most of my VCS management (I’m so sorry, I’m just not a command line person, I need to actually see it). With the new laptop, I haven’t installed SourceTree yet and I’m going to try and do everything via the IDE. Previously I used the right-click menu mostly for managing VCS operations, occasionally the VCS menu, and did most stuff in the “Changes” window. But now I’ve discovered Alt+"Back Quote” (Ctrl+V on the mac) to bring up the menu of git-shaped operations for this context. To stop you having to hunt all over the keyboard to find what on earth a “Back Quote” is, it’s `, which on both my UK and US (Windows) keyboards is in the top left corner of your keyboard (on the Mac, it’s on the bottom left next to the shift, but you shouldn’t need it since your shortcut is different anyway).

Amend Commits

I’ve just discovered that you can commit a change which smushes up into your last commit and fixes it. I’m assuming it commits the new changes and (potentially) an updated commit message into the last change. I really wish I’d known about this earlier, on a number of occasions in the last few months I’ve done this either manually or by doing a rather dangerous soft reset. I will definitely be using this in the future.

"Amend

The Cursor as a Breakpoint

Did you know that you can use the cursor as a temporary breakpoint? I did not. Well, now you know.

Labelling Changes

I hope by now none of us developers are doing that icky thing of having “Copy of…” and “Backup of…” filenames and directories to keep track of our versions. We’re all using a VCS of course. But if you’re being strict about making sure that every commit leads to a working build (we all do that, right…?) then sometimes even distributed file systems like git, with its local branches, are too heavyweight for experiments and debugging.

IntelliJ has Local History, which I personally think you should never rely on, but has occasionally saved my bacon in times of strife. It also does this really nice thing (automatically) where it labels versions where the tests passed, so you’ve got some level of confidence that at that point in time, at that revision, things weren’t hideously broken. At the very least, they must have compiled. What I did not know is that you can add your own labels, so you could label some local, non-committed version of the file as “feature x works but y doesn’t” (or probably something much shorter).

I think it looks useful. As I say though, not a replacement for VCS, but a suppliment.

So, that's the end of Week One at JetBrains, and already I've learnt a whole heap of things. I'm sure there's more to come, so stay tuned!

New IntelliJ Tricks I Learnt Today

Day three of my brand new job - woohoo! One of my first tasks is checking the documentation of IntelliJ, since I’m already a “Power User”, to see if there’s stuff missing that someone like me might want to see. Firstly, a confession - I’m not sure I’ve actually read the IntelliJ documentation before. I mean, really read it. Of course, I’ve dipped into it when I needed to know something, I’ve searched for help with specific items, but like many developers, I tend to use something first rather than read the documentation first.

But I’ll tell you what, today I’ve learnt a whole bunch of useful things IntelliJ can do that I hadn’t previously known, and they’re the sorts of things you would only stumble over if a) you read the docs (pah!) or b) you watched someone else using the tool and saw them doing something you didn’t know was possible.

So here’s today’s list, and feel free to laugh at me and be smug in my direction if you already knew these things (note: I have upgraded to IntelliJ 14, and at the time of writing I don’t know which of these features are new and which are simply previously undiscovered):

Press Shift+Ctrl+A (Windows) or Shift+Cmd+A (Mac) and start typing the name of the thing you want to do, or the setting you want to change. I’ve found this especially useful now I’m back on Windows and I don’t have that nice helpful typing box on the help menu that will take me straight to the menu item I want. But what’s most useful about this for me today, as I’m setting up a new profile on a new laptop (more on the new laptop later, if it doesn’t defeat me utterly) is that from here, you can turn various settings on and off without having to navigate through the settings screen:

![](https://trishagee.com/wp-content/uploads/2015/01/action-300x226.png)

Statement completion

I never knew there was a shortcut for finishing off a statement, all that Java boilerplate you need to keep the compiler happy - semi colons and curly brackets and everything. But there is, and I can see it being super useful, especially if you’re using other bits of IntelliJ code completion to create the core of your line of code.

Issue tracker integration

I’m sure loads of people are already using integration with their favourite issue tracker, but I hadn’t really thought about this as something that I really cared about. But I was watching the intro videos for YouTrack (not surprisingly I’ll be using this instead of Jira during my time at JetBrains) and when I saw how the IDE integration worked, I suddenly realised how this small thing can add up to save thousands of keystrokes over time, not to mention saving precious navigational seconds and window-switching.

For me, just the ability to generate at least the start of the commit message is a saving in time, and adds to project consistency if all your developers are doing the same thing. On my last project we only just realised we all quoted the Jira issues in subtly different ways.

Settings shortcut keys

When I initially started using IntelliJ in anger back in 2008, I was very much a point-and-click type user. Over time, pair programming with keyboard-super-users and giving live demos with very limited time available, I’ve worked harder to become a keyboard-shortcuts person. With the latest version of IntelliJ, I can’t find the tiny icons I use to get to the settings window, something that I’ve been using a lot as I set up the new IDE instance on the new laptop. So I bit the bullet and learnt the keyboard shortcuts, and it’s already saving me a bunch of time (on the rare occasions when the aforementioned “Navigate to Action” fails me).

Ctrl+Alt+S for the settings dialog (appears to be Cmd + , on the Mac) Shift+Ctrl+Alt+S for the project structure dialog (appears to be Cmd + ; on the Mac)

![Settings](https://trishagee.com/wp-content/uploads/2015/01/settings-300x55.png)

Yeah. I can’t believe I wasn’t already using those either.

Selecting the negative

I use completion/suggestions all the time from IntelliJ, I’m far too lazy to type everything. What I didn’t realise, is that you don’t just have to accept the default they give you. If, for example, IntelliJ suggests a boolean value, you can get it to negate that value by selecting it with “!” instead of enter or tab. Yes, I know I’ve done a horrible job of explaining that, but take a look at the documentation and try it, it’s quite cool.

Exclude from Autocomplete

Speaking of code completion, sometimes IntelliJ is sometimes just a bit too keen to suggest something, and you really will never want that value. In the past, I’ve always used Settings -> Editor -> General -> Auto Import to manage the suggestions (the most common one for me is I will never want java.awt.List, I will almost always want java.util.List). Well, you don’t have to go into settings to do this, you can do it from the suggestions themselves - navigate to the item you don’t want (in my case, java.awt.List) and press Alt+Enter, this will give you the option of excluding this from the suggestions in the future.

That’s what I found from just one day of browsing the documentation and setting up my IDE from scratch yet again. Maybe I’ll promptly forget all these, or maybe they’ll be new weapons in my armoury of IDE-fu. Either way, maybe one or two people will find this useful.

New Year, New Adventures

Just over two years ago, I embarked upon a journey as a developer / evangelist for a company who was then called 10gen (who got fed up of saying "the MongoDB people", and transformed into MongoDB Inc). My goals for this role were: to learn what it was like working for a company that produced a technology product; to discover what impact working in an open source fashion has; and to level up my advocacy skills. I have met all these goals, and more - I met some fantastic people; learnt different approaches to software development; discovered my new favourite database for creating applications; moved to Spain; started both a MUG and a JUG; worked to understand the value of community and evangelism, and to help create a strategy for these areas; and my evangelism efforts and open source work earned me the Java Champion title. I'm extremely proud of what I've achieved over this period, and very grateful to MongoDB for giving me these opportunities.

But now, a new adventure is about to begin. If you've seen my live coding demo this year, you'll know of my love affair with IntelliJ IDEA, a tool I use daily (even for blogging). Well, now I'm joining the team at JetBrains, where I'm going Full Advocate. I hope this means I get to carry on doing more of what I love - presenting, writing, and working on demos to help developers become more productive. I hope this will give me opportunities to stay ahead of the curve in the Java/JVM world.

And yes, in answer to the Most Frequently Asked Question, I am staying in Spain. I've fallen in love with Sevilla and I'm not ready to leave yet.

I shall leave you with my somewhat disasterous "Top Ten IntelliJ Tips" from GOTO Aarhus, which is worth watching just to see Dan North save me from the curse of the live demo. Things can only get better from here, right?