Recently we moved to a new office and I decided to change the orientation of my primary programming monitor from landscape (the default way you would see a 16:9 monitor) to portrait. Another colleague of mine had done this some time ago and I asked him how his experience was programming like this and he enjoyed it. I have also spoken to a couple of other individuals who have also recommended it. After trying it out for over three weeks I am really enjoying the orientation of the monitor as well.
There are a couple of reasons why I feel that changing your primary programming monitor from landscape to portrait is beneficial. These include:
- Writing “better” code – now when I mean “better” code, I do not mean more efficient or optimised code. What I mean is code that just plain looks better and is easier to understand and ready. In IntelliJ (the primary IDE I use at work) there is a right margin or hard wrapping guide that is displayed by default. I tend to write code that does not cross this line anyway, but having code that flows down and not across the screen I find is easier to read. Plus it forces you to think long and hard about how you structure your methods and what they do. For example, you cannot have too many nested if statements, for loops, etc. because if you do your entire method’s body is slowly getting shoved into the middle of your IDE. It certainly will cross the margin and wrapping guide, and if you have your monitor in portrait mode it becomes difficult to read the entire method’s content without scrolling horizontally.
- More code – not only is there “better” code written, but you get to see more code. When I am creating classes and methods, I tend to think about how they should be constructed, and what they should have in them. Typically they do not bloat out to more than one thousand lines of executable code for a class for example. If they do then I need to rethink what is actually trying to be implemented and potentially refactor and restructure the class (and/or classes) better. Being able to see more of the methods used in a class, etc. can be super helpful when trying to work within a class that needs to be refactored or have new methods added to it.
However with these some of these benefits that help improve the structure of your code and what you see, there are some pain points and frustrations that may arise which can be fixed or mitigated. The main ones are:
- Your IDE tabs – these include such things as your Project tab, Structure tab, your Maven Build tab, etc. By default these tabs sit on the left and right hand side of your IDE (for IntelliJ by default anyway). If you are a fan of keeping these open (I am not) then you will lose even more real estate to write code. But you can either move them to the bottom bar where generally your Terminal, Output, Debug, etc. tabs are stored or you could even pop them out to a new window. I generally tend to move them to the bottom but I have had them floating as separate windows as well. Both options work with minimal issue.
- Horizontally written code – not all the code you will see in a project’s repository will strictly enforce the use of the right margin, especially old and legacy code. Sometimes you will see code that requires you to scroll even if your monitor is oriented in horizontally, this I generally find will come in the form of the parameters passed into a method (the method should probably be refactored as it most likely is doing too much with too many things) or there is a long block of string that has no break. Unfortunately this is more difficult to fix. Methods with a large number of parameters and variables passed in should send alarm bells ringing that this method may be doing too much and needs refactoring, but you can add new lines after ‘x’ number of variables. For long strings you can keep it, but you can also split the string up. So there are solutions but will require a little work.
Overall I am fairly happy with the new switch in monitor orientation. Do you code with a monitor oriented in portrait mode? If so how are you finding it. If you moved from horizontal to vertical and then back, what did you not like and why did you switch back? Let me know in the comments below.