Acorel
Gratis demo
Acorel background

9 tips to become a more productive developer

Azzeddine Daddah

This is not a how-to article, nor an article where some nice SAP Commerce features are explained. In this short blog, I’ll try to share some tips that can help a Commerce developer to become more productive.

Developing a new SAP Commerce extension, AddOn or patch can sometimes be a complex task. As a developer you need to keep track of many things at the same time and it can be easy to get distracted and lose focus.

In this blog I’ll share a couple of tips which I personally use, and which work (at least for me) J. These tips may also help you to become a more productive SAP Commerce developer. Actually, most of these tips have nothing to do with SAP Commerce directly but can be applied to any kind of Java development.

1 – Get yourself a good development machine & good keyboard

SAP Commerce is a Java application that can run on many system combinations. It’s a heavy application and therefore it needs a serious amount of RAM and a good CPU to run. The following minimal requirements are recommended by SAP for installing/developing SAP Commerce on your machine:

CPU Quad Core, for example i7
RAM 16 GB
Hard Disk SSD
Hard Disk Space 20 GB

I do have a similar specs, but many times during the development process, I wish that I had more resources. A fast development machine will seriously decrease the amount of time for building and starting your local SAP Commerce application.

Here is my personal MacBook Pro configuration:

    • MacBook Pro 15-inch
    • Processor: 2,5 GHz Quad-Core Intel Core i7
    • Memory: 16 GB
    • Hard Disk: 500 GB SSD

To translate your fancy idea from your brain to nice looking code, a good keyboard is your friend. There are many good keyboards on the market, check this list: https://coderseye.com/best-programming-keyboards

2 – Command line

When developing SAP Commerce, you’ll find yourself opening the terminal a couple of times for building, testing, starting or stopping the platform. Not only this, but also listing the files, searching into files and a lot of times investigating the log files.

I recommend every developer to get in touch with his shell, Unix commands and piping. Even if you’re a Windows user you can use Cygwin or Bash to get a nice and usable shell to use. Believe me, almost every GUI operation can be done via the command line.

If you’re developing on a Unix based system, you’ve probably already used Bash. If so, I really recommend you give Zsh (Z shell) a try.

The Zsh shell offers countless options and features that can help you boost your efficiency from the command line. To list all the features, I need another blog ;). But I’ll list my favorite 3 features which I use every day. Surely, they save me a lot of time:

Directory Shorthand

I personally hate typing long directory paths to get to a location in my shell. Zsh has a nice solution for this annoyance. It supports its own version of shorthand which lets you type only the first couple of letters of each directory in the path. Zsh will match these letters to the full path and displays the choices to you if applicable. When you enter for example

$ cd /l/j/e

into the terminal and press <TAB>, ZSH will expand it out to the full path

$ cd /Library/Java/Extensions/

Tab completion on “cd”

When you press <TAB> in Bash, you get prompted with a list of files in the current directory. In the context of the cd command this isn’t particularly useful, as you can only go into directories. Zsh on the other hand knows that you want to change to a directory and therefore only the possible valid destinations are displayed. Not only does it help you with matches, it also allows you to use your keyboard to navigate to the directory you want to go to.

Aliases

This is not a Zsh feature, but a Oh-My-ZSH feature. Oh-My-ZSH comes with a ton of excellent aliases for everything from navigating between directories to common programs like Git and Systemd. Below are some aliases:

9 tips to become a more productive developer, Acorel

The complete list of all aliases can be found here: https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet

Autosuggestion

This is maybe my most favorite feature. As a developer spending a lot of time in my IDE writing code, I’ve developed a habit of pressing the <TAB> key to get suggestions to select from. Zsh has a nice plugin that does this and does it good. The plugin suggests commands as you type based on history and completion.

9 tips to become a more productive developer, Acorel

https://ohmyz.sh
https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

3 – Use JRebel

One of the irritating things in developing SAP Commerce, is the build and start process of the application. Those operations can take a lot of time. Depending on your machine and the size of your application of course, it can take minutes to build and start the application.
When for instance you implement a new bean (say a new PrepareInterceptor), you have to first stop the server, build the application and then start the server. The same should be done when you add a new change to your new interceptor. This takes time… Imagine that you’ve to do this a couple times a day!

JRebel is a JVM plugin that lets Java developers instantly update code and see those changes reflected in their app under development without restarting the application server. When using JRebel, you’ll notice that you often at most need to do 1 restart during the whole day of development. You build once, start once and focus on what really matters (implementing new features or fixing bugs). By using JRebel, backend development can be made as fast-paced as frontend development.

In this page you can find a guideline of how to get JRebel up and running with SAP Commerce https://manuals.jrebel.com/jrebel/standalone/hybris.html

4 – Read other people’s code

A good developer learns from reading other people’s code. This is one of the best ways to learn new things and discover new idioms, libraries, patterns or techniques than what you already know and use. A good start is to read the SAP Commerce code, code of used external libraries, code of your colleagues.

The more code you read, the more comfortable you become with reading code that is written by others, the better you get, the more productive you’ll be. The will also help you doing code review within your team.

5 – Write clean code

If you love to read simple and clean code, then you’ll also have to train yourself to produce nice and clean code. Try to write code that is simple to read and simple to understand.

Clean code in my opinion is code that is easy:

  • to understand
  • to maintain

Code that is easy to understand is code that explains itself. That is code which when you read it, you understand what it does and why it does what it does. Also, you don’t need somebody to explain it to you.

If you want your code to be easy to write, make it easy to read
— Robert C. Martin

Writing clean code can take some extra time in the beginning, but you’ll find soon that producing clean code leads to less bugs and will also help you to be more productive by producing more code in less time.

6 – Master your IDE

A good knowledge of your IDE will help you get things faster. Why should you write the getters and setters of a data object if your IDE can do this in 2 clicks? Try also to master the shortcuts of your IDE as they’ll help you to get things done quickly.

Make your life easier by using plugins. Do not repeat yourself. Plugins can for instance help you quickly spot errors, get suggestions, syntax highlighting, auto-completion, inspections, code formatting etc.

I’ve switched 6 years ago from Eclipse to IntelliJ, and I admit that I didn’t regret it. Currently I use the Ultimate Edition (thanks @Maurice Rootjes). Below a list of the plugins that I use:

  • Batch Scripts Support
  • .ignore
  • Integration for SAP Commerce
  • JRebel for IntelliJ
  • Lombok

Remember, the more you master the abilities of the IDE the more you can get things done quickly, the more you become a productive developer.

7 – Automation

Try to automate everything that you do repeatedly.

Actions like “ant clean all”, “./hybrisserver.sh debug”, “git fetch && git merge origin/development” are maybe command that you type a couple times a day. Try to make aliases for those commands or write scripts which does the same.

8 – Ask if you’re stuck for more than 30 minutes

Sometimes if you encounter a difficulty (say you want to extend an existing CMSComponent) and you cannot figure it out within 30 minutes, instead of trying and trying ask your mentor or colleague for help.

9 – Focus

Focus is one of the essential aspects that you have to learn and train yourself to do. When we talk about productivity, then there is more than just the craftsman techniques and tools.

As a developer, you need sometimes to focus when writing code that requires concentration. The following tips may help you get focused when working on that particular task:

  1. Plan 2 times a day for reading and replaying to your e-mails
  2. Close your e-mail and chat programs
  3. Mute your smartphone or off unnecessary notifications
  4. Use a headphone (preferably one with noise canceling)
  5. Drink good coffee 😉

Azzeddine Daddah