Posts

Confluence Alternatives

Is Confluence your documentation / knowledge-management system? Are you sick of its shortcomings? Poor and non-standard rendering. Lack of markdown support. Weird and inconsistent handling of unicode. Do you still think Confluence is a boon for document writing? Just be aware that there are better alternatives.

Anorm Primer

A primer on Anorm to use the interesting parts - core and combinator functions, as opposed to the mundane way of reading the column from Row. The post highlights situations when you don’t have a predefined type for the parsed row, and you are dealing with discrete columns in the result set based on time and need.

Article hero image

scala-cli - A Breeze

New tool on the block is scala-cli (from virtuslab.org) - a clean simple approachable non-fluff command line first interface to the Scala language.

Article hero image

My Everyday IntelliJ Plugins

If IntelliJ is the perfect main course, its plugins are the seasoning to spice it up. There are hundreds of popular plugins that rank in probably every post on IntelliJ plugins. However, the ones listed here are those that I use almost everyday. Besides, I like using these plugins, and highly recommend.

Rebooting on Ghost Land

Many languages support union types, and it is high time Scala did. Union types are coming in upcoming version of Scala - Dotty. Union types (|) are already being compared with Either and Option (disjoint unions).

Either Disjoint or Union Types

Many languages support union types, and it is high time Scala did. Union types are coming in upcoming version of Scala - Dotty. Union types (|) are already being compared with Either and Option (disjoint unions).

Know Thy Option

Avoid .get at all costs. Forget there is even a .get function on Option. There is always a way out - better one, than using .get. Same applies to .head

If you are going to have access the value in an Option in a test class, prefer extending your test class from OptionValues. Then you can use .value on an Option. Doing so establishes the presence of value as verification with meaningful error if value is not defined.

Pattern for Saner Mocking

It is common to see mocks being setup this way in unit tests.

scenario("Test Case 1") {
	...
	when(addressResolutionService.resolve(...)).thenReturn(...)
	when(vendorInventoryService.checkInventory(...)).thenReturn(...)
	...
	.... another bunch of when and then returns
	when(shipmentService.schedule(...)).thenReturn(...)

	...thisIsTheActualCalltoTest(...)

	verify(vendorInventoryService, 1).checkInventory(...)
	... other such verifications
}

scenario("Test Case 2") {
	...
	when(addressResolutionService.resolve(...)).thenReturn(...)
	when(vendorInventoryService.checkInventory(...)).thenReturn(...)
	...
	.... another bunch of when and then returns ...give or take one or more mocks compared to the previous test ...
	when(shipmentService.schedule(...)).thenReturn(...)

	...thisIsTheActualCalltoTest(...)

	verify(vendorInventoryService, 1).checkInventory(...)
	... other such verifications
}

... other such test cases
More ...

Cyrilex โ€“ Online Regex Tester

A while ago, I wrote the online regex tools. Cyril (@CyrilBois) came across that post and mentioned about his regex tester tool.

I think every tool should have a name; not one that just goes by its function but a nickname, if you will. So, I am going to name Cyril’s regex tool - Cyrilex. Don’t like it, don’t worry about it.

Instead of adding Cyrilex to the list, which I have already, I took the liberty to sort of review the tool. Because it has got a few cool things that I love.

More ...

Go away node/npm

If you haven’t found a use for this script that uninstalls the second largest junk in the world next to Mac/iOS updates, you are either lazy or scared of breaking things. I am neither, so I polished this script from the different versions you will find on the internet. Oh, I am talking about node/npm.

Happy cleaning!

More ...