lessons learned + News in December 2018

Posted by Steven

This is what I learned in December 2018:

  1. Already a while ago, I began using the wonderful KeyJump extension in my browser Vivaldi. It allows mouseless navigation through websites by displaying small numbers next to each link. By typing those numbers, either the current tab is used to navigate there or a new tab.
  2. Starting from now, I also add information about upcoming talks and workshops I'm involved in. There have been questions about how to keep updated about my future activities, this is a quick-to-implement solution.
  3. My current main project is to develop an Angular application. That's a great way to achieve my goal of learning more about web technologies. A huge aspect of this learning involves writing tests to make sure that our implementation is doing the things it's supposed to do. I already learned that writing unit tests with Jest is very comfortable and easy. However, those don't cover more complex workflows in our web app. I added learning about WebDriver tests to my todo-list but didn't get to it yet. During a meeting with the customer, I (again) learned why these integration / system tests are necessary. Although we wrote tests for each component, the functionality of saving the entered data went crazy and we all looked at each other, puzzled. Quite uncomfortable, but we have an understanding product owner so that posed no real problem. Hence: Don't only write unit tests and expect that everything will work fine. It will not. Write additional integration tests.
  4. Recently, we wanted to analyze a strange error in our build pipeline by looking at the logs. To our surprise we discovered that they exceeded the maximum log size and have been abbreviated. A colleague suggested to run Maven in Batch-mode. That lead to complete logs because this mode doesn't show progress entries that otherwise would spam the whole log.
  5. In my attempt to connect an application to an LDAP, I had to add a certificate to my JDK. This is the command for this, executed in the bin-folder of the JDK: keytool.exe -importcert -file ..\ldap_cert.pem -keystore ..\lib\security\cacerts -alias "someAlias"
  6. Ony of my team-members showed me a better way of using a specific Spring Security user in JUnit tests. I called SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken("tom", "tom"));" which can be replaced with the annotation "@WithMockUser("tom")" above the test. This is more appropriate for the annotation-focused "Spring-way". Of course, if the current user has to change during the execution of a test, that has to be done via the SecurityContextHolder.
  7. Running an Angular demo application, I had the problem that the wrong port was called (4200 instead of 8080). The 8080 port was defined in the proxy.conf.json but not used. From SO I learned that "ng serve" is the Angular-CLI command to run Angular. "npm run start" is the command to execute the start script defined in package.json (in which the proxy.conf.json is referenced). The latter should be used in production (because not every server has Angular-CLI installed) and in development because it uses the right scripts.
  8. I learned about the spread-operator "..." in JavaScript.
  9. I thought about the changes in the company I'm working in and wrote an article about the AMIs introduced.

This is what I'm working on right now / planning to do in the near future / other stuff:

  1. On 21st of February 2019 I'm going to give a talk about my self-management system in Hamburg.
  2. In March I'll facilitate a legacy coderetreat together with Falk Sippach at the Javaland in Brühl.
  3. Besides my main project at work, I'm developing quite a lot in Angular in the last few weeks. There will be a nice and juicy new version of one of my pet-projects soon. :)

(Photo: adrian825http://www.istockphoto.com/photo/monthly-management-reports-36658768)