A while back I decided to make a progressive web-app and for the fun of it, learn a new framework (Angular 7 at the time, 9 now), language (TypeScript) and to top it all off, challenge myself by test driving the entire thing.

Before I dive into our main thought, a little disclaimer: I’m sort of a full-stack developer; meaning my world rotates around developing microservices with Dropwizard + Java 8, a little bit of front-end with Backbone & Marionette + JavaScript and a little of Oracle on DB side. Uninspiring and outdated, stack is my daily existence. Regardless of stack, I do test drive all of my code, I believe it is a good idea and I have been doing it for a while now.

From the very inception, I decided to test drive my app and to do it only with unit tests and depending on your definition, integration tests. After years of writing, re-writing and maintaining end-2-end tests, I figured one thing only: they are a waste of time and money. So my entire app is test driven by jasmine specs, starting at individual components (or a service) and moving onto a combination of components (how they work together) and culminating with the main component which is mostly in charge of testing navigation through out the app.

Now, to test a component in Angular (to the best of my knowledge and understanding) is to test a template and associate code together as one thing (unit of work). This represents a bit of a challenge, mostly associated with manipulation of UI. Effectively you will be doing a lot of query selections, clicking, and sometimes dealing with async and Angular change detection. Since I get to work on my app few hours per week, I tend to forget (sometimes rather quickly) fine details of writing a component test. Like the saying goes: “if you can’t beat them, join them”, so I gave up on constant rehashing and decided to write my own test helper, which is easy to use and doesn’t need much to remember. For example, find an element with the placeholder value of “name”.

In addition to all of the above, jasmine errors tend to be verbose and not very user friendly. For example if you are trying to query select all elements, which don’t exist (but you assumed they did) and then call a method on a particular one, you will be met with off-putting exception “undefined is not an object”.

TypeError: undefined is not an object (evaluating 'this.findElementsByPlaceholder(placeholder)[0]') in http://localhost:9876/karma_webpack/main.js (line 3909)

I believe we can do better than that. We can wrap “query select all” calls in your own method, check length and if there are no elements then simply throw an error with explanation. For example:

Error: Could not find a placeholder: name in either of tags: placeholder,ng-reflect-placeholder in http://localhost:9876/karma_webpack/main.js (line 3906)

By doing so, you effectively eliminate confusion and save yourself some time (at least I do). So go out there and throw some well-explained exceptions, so you don’t have to guess which object is undefined and why.

Cheerz.


Today in the morning I spend couple of hours trying to implement dropdown with filter and “valid only” entry. I started my endeavor with ng-bootstrap dropdown (since I’m working on Angular app), quickly realizing that it will not work since there is no filter option. Next I figured that a typeahead will fit much much better.

Everything worked out very well except for one big caveat: the typeahead does not clear “<input>” field when entry is not valid (not in the list of options). After monkeying with “onBlur” for about 20 minutes, a sane thought occurred in my head: “What am I doing? Hacking? There must be a straight forward way!”.

Welcome Multi-Select Dropdown

The Multi-Select Dropdown also supports single option:

It looks promising and I’m very happy someone figured it out, however I wonder why doesn’t ng-bootstrap include such a useful component?


After readying and breaking your head for a while, you finally demystified a piece of code and staring at it you wonder: “why does it have to be so complex”? – Has this ever happened to you?


Oh uncle Bob, where would we be without you & clean code?

Also check out thought provoking talk about developers and responsibility


From time to time I like to take a break from brain wrenching talks and watch something relaxing, fun and educational. Enjoy.


Really good talk by Sam Newman.


Yeah, Java 8 is done for it, but not everywhere, some are still programming in it. In any case, I enjoy Venkat’s talks (even attended one many years ago) he never skips the beat.


Great talk about team leaders & dev. teams. If you liked the talk and need more insight, you can read Roy’s book: “Notes to software team leader”. I enjoyed the book greatly.


If you haven’t migrated to jUnit 5, this talk will provide most important overview. Yes, it is dated, but I still found it to be valuable.


I don’t remember when or how I came across this talk, but I’m sure glad I did. I believe, the talk is a good starting point if your team is struggling in a decision making area.


Recently found, quite interesting and entertaining talk. I hope it will shed some perspective on the development process.

https://youtu.be/TQ9rng6YFeY

Old but quite an interesting talk


I have been in the IT industry for more than a few years now and switched a few managers (and work places). Out of all the managers this far, I only had one decent one. In general all the managers I came across seem to be fairly useless. They don’t seem to support the team and always take the most convenient position on matters – which translates to the usual see nothing, do nothing. From time to time I’ve been wondering: “what makes a management job anyways?” – because from my point of view, they don’t bring any value to the team. Perhaps in other industries or places managers are essential, but in development teams…

Today I came across a very interesting article and was somewhat surprised has been written 11 years back. After few moments my surprise turned into a few thoughts, one of which: if information on good management exists, why are there so many useless managers? Naive and rhetorical question, but I do keep asking it from time to time.

If anyone is interested in managing geeks or understanding IT mentality, please read the article and I attached PDF copy in case the article got lost.

Cheers.


I don’t like using term “fan”, however I do read Martin Fowler’s posts and tend to agree with him a lot. His recent post brought feeling of familiarity and a bit of pain. I would like to share it with anyone who is doing software development.

PDF version

I hope you will find it useful.


A while back, I worked on N26 coding exercise and found the problem quite entertaining. Figured to share it:

N26 coding exercise

Correct, with minor test comments (should not use Thread.sleep(…)) and not entirely efficient but clean and 100% test driven solution can be found here and backup: here.

I think this exercise worth while, do it just for fun and giggles :)


Next Page »