Ashik’s IT Thoughts

November 23, 2015

Java Programmer’s Life

Filed under: Uncategorized — ashikuzzaman @ 8:32 pm

November 20, 2015

Working with Fixed Map – Unmodifiable or Immutable?

Filed under: Java — ashikuzzaman @ 2:18 pm

We often have to work with a defined collection of values in our programs. Maps are one way of holding those defined values and retrieving those by names when we need to use. One easy way of reusing those predefined values have been using static maps in a class so that we don’t instantiate those same values again and again every time we use it. That’s a very basic and minimal thing to start with for any program.

But as your system goes bigger and you start sharing code among many team members and many modules of your system, and as performance issues become more important than anything else, and on top of it if you are working on multi-threaded environments – you know you have to play the game at a higher level than this.

We recently hit a relevant bug around using static hashmap that led me to refactor and restructure a similar basic code to a more sophisticated fixed collection. I learnt that the use case for a completely fixed map is not well understood and clear to everyone. At the end of the analysis and refactoring what I came up with can be simplified to a small program that I developed for my readers here.

Please look at my public github repository for the source code while I walk you through it –

There are two major ways of generating a fixed map other than writing your own collection data structure. First option is what comes with Java Standard Edition – an API to make any collection unmodifiable that gives you a read-only view of a modifiable collection. For Map it is Collections.unmodifiableMap(map).

Second option to make a map fixed we get from Google’s Guava library – Immutable collections. For Map, it is ImmutableMap which can be used instead of HashMap that we use more often in simple java programs. It makes sure once you build the map, you can no more add, update or remove any entry from it. While both of these give you a simplistic fixed size map, they have important behavioral difference. Additionally, none of them can guarantee you a truly fixed map where not only entries can’t be manipulated but each value for each entry also can’t be manipulated either. Let’s see where the gap is with them and how we can overcome the gap.

In, and from the above project, we are working with a modifiable map, an unmodifiable map (that wraps around the modifiable map) and an immutable map (that picks the values of the modifiable map to build itself). Both unmodifiable map and immutable map, once built, will not allow you to add any new element, remove any existing element or update any element with a new value using their own references. But we can add any number of elements to modifiable map even after the other 2 maps are built out of it. And that’s where the difference between unmodifiable map and immutable map becomes evident. Look at the program output for first 4 print statements and see where unmodifiable map falls short. While immutable map wont change in size even if you add new entry to the modifiable map out of which it was built, the unmodifiable map will increase in size as long as you are using a different entry point (other than the reference variable of unmodifiable map itself) to the modifiable map to add new elements. So clearly, Immutable map has an edge over Unmodifiable map when it comes to working with fixed maps.


However, the next 4 print statements (5 to 8) show the shortcomings of both unmodfiable and immutable maps. When you say the map is immutable, you are only making sure no add, delete or update happens at an element level, more precisely, using the key of the element. But nothing is stopping you from adding a new element inside the values of a map, if the value itself is a collection. So in our case each map element values are individual set of Strings. So nothing is stopping the program to add values inside those Strings using the unmodifiable or immutable map references. This is the result of famous copy by value and copy by reference debate of Object Oriented Programming. And hence you see new values got added for “animals” as part of #7 and #8 prints. So despite Immutable map doing a better job than Unmodifiable map, I call it a fake fixed map. A true fixed map, better if I coin a term fixed content map, needs to ensure that even the individual values for each element is untouchable (i.e. read only).

To achieve that we extend FixedContentMap from FixedMap (because all fixed content map is a fixed map but some fixed maps may be fake fixed maps!). We just build the values in fixed content map as immutable sets. So now if anyone wants to change the value of the fixed content map, including the contents of any element – they will face a java.lang.UnsupportedOperationException as is evident when you run the program (you won’t see print statement #12 ever getting executed).

So my conclusion is, if used correctly, Google’s Guava library will allow you to work with truly fixed content collections in Java.

October 15, 2015

The Mythical Man-Month by by Frederick P. Brooks Jr.

Filed under: Uncategorized — ashikuzzaman @ 8:58 am

October 7, 2015

Joined TubeMogul Leaving Salesforce

Filed under: IT, Official — ashikuzzaman @ 11:30 am

It’s been 6 weeks since I joined TubeMogul leaving Salesforce. The decision to leave Salesforce was not an easy one, as Salesforce is one of the leading and most innovative software companies in the world with approximately 17 thousand employees. When I joined there 8 years back, they had a little more than 3 thousand employees. So I saw Salesforce rising at a pace, that is only believable if you live in Silicon Valley’s startup atmosphere. I was in a good book in my own department and had a good network of people working in different departments; as I have been working there for so long. There were further growth scope and no doubt Salesforce pays good enough to employees in Silicon Valley (I have to assume elsewhere too). So why move out of Salesforce at all? Here was my rationale.

I have been working in IT Applications Development since my early years in Salesforce. The first half (4 years) I was working on a Java based module and the last half I have been working on / Apex (Salesforce’s own programming language developed on top of Java). During the second half I started feeling that I am getting out of touch with the Open Source projects and Java community; as being an application developer, I didn’t get a chance to do platform development which allows you to experiment with lots of cutting edge new open source frameworks coming out or the JVM based programming languages. So I considered moving within Salesforce to one of their platform teams but then I became part of a very large project (Project Delight) which I didn’t want to miss. The project took 2 and half years to finish and it was a very good experience in my career, seeing first hand how a large number of teams, each having its own development culture can work together to achieve a bigger goal and what various types of obstacles can come on the way. But once that project was done, I was getting ready for a bigger role on the next big project. But then I started feeling that the core problems that are awaiting me, we have already solved many of those in my last project. So instead why not jump into something completely new, where I will be hopelessly helpless?

That’s when one of my ex-colleague simply submitted my resume to a software company despite my reluctance (confession: I am a lazy person). But as my interview was scheduled. I started looking into what is there in the latest java world and I saw that the companies are moving to Java 8. When experimenting a few programs in Java 8 following the Manning book, I clearly understood it’s a complete revamp of the Java programming language. Lambda expressions, streams, functional style programming are few that excited me too much and I was no more ready to get back to Apex coding (not that Apex is bad, its just proprietary). I honed my Java 8, data structures and algorithm, spring and other open source projects familiarity for couple of weeks to get ready for interviews.

As naturally happens, I got selected by a few companies and rejected by a few others during the interview process. The job market is so good that I had at least half a dozen more interviews waiting for me the next week before I decided to stop interviewing and pick the best I had upto that time. TubeMogul was a clear winner in many areas. Of them are –

  • They are complete java and open source shop
  • They have different engineering teams where you might be able to move around over time – platform core (rtb), machine learning, big data & stats, ui, udb, appeng and more….
  • They are the 5th best place to work in San Francisco Bay Area according to Glassdoor review of 2015
  • They are a mid size company (500+ employees) making it ideal for a growing company and yet not too small to go bankrupt
  • Their business domain Real Time Bidding (RTB) is something completely unknown to me. So it will definitely pose challenges to me in multiple levels (which is what I was looking for).
  • They offered me a decent package. Although I humbly note that if you are working in Silicon Valley as a software engineer, most of the companies will offer you a good package; otherwise they won’t be able to attract or retain good employees.
  • I liked talking to each of the 4 people who interviewed me in TubeMogul as well the recruiter who handled the whole negotiation process in a very professional manner. My manager Murtaza is a very composed man, something similar to Rajesh Misquita at Salesforce whom I admire a lot.

I did let my team in Salesforce know 6 weeks ahead of time about my decision. I went to Bangladesh on vacation for 3 weeks to attend my brother’s marriage in between. I left a good relation with the management and peers before leaving Salesforce. I will always cherish the memories of working in such a nice a big company like Salesforce. But it’s time to move on.

When I joined TubeMogul, I saw my assessments were mostly correct. Except Java, I think everything else was simply unknown to me or I have used/worked on more than a decade ago. I still have not mastered the way to explain what RTB industry is all about. One of the very first things I did here is formed TubeMogul Chess Club. The pace of work is fast and everyone is very friendly. Let me go through a few more months, but as of now I believe my decision was correct to join TubeMogul.

June 4, 2015

1 Day Delivery from Amazon Prime – Java 8 In Action by Manning Publications

Filed under: Uncategorized — ashikuzzaman @ 9:44 pm

I got 1 day delivery by amazon prime today of the below book.

Java 8 in Action: Lambdas, Streams, and functional-style programming
by Raoul-Gabriel Urma et al.



Youtube Video:

Manning Page:

Source Code from Github:

Spring with Maven using Spring Boot

Filed under: Uncategorized — ashikuzzaman @ 5:20 pm

I started playing around Spring after a long time. I needed to quickly get ramped up and hence used Spring Boot module to get spring,maven, embedded tomcat up and running. The sample files in this example I have committed to my public github repository here –

You can use the below steps so hat you can use too to get started –

1. make sure you have java installed and path, java home mentioned in bashrc file
1a) verify “java -version” or better yet “java -XX:+PrintCommandLineFlags -version”

2. sudo apt-get install maven
2a) verify maven installation by “mvn -v

3. create a directory for your project and create an emlty pom.xml file there to be used with maven.

4. Update pom.xml file with the content similar to what is in /home/auzzaman/dev/coding/java/maven/pom.xml

5. Once pom.xml is created, open up a terminal and go to that same folder where the file is. Lets say this is your project home or maven home. Now run the command “mvn package” from here.

6. Now run “mvn:dependency:tree“. It should download dependency files

7. Now update pom.xml to add a few more dependencies. For example add it –

8. Now create directory structure under maven home as src/main/java. For example, my directory structure is /home/auzzaman/dev/coding/java/maven/src/main/java

9. Create a new java source file in that folder with the below content –

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;

public class AshikHelloWorldExample {

String home() {
return “Hello World!”;

public static void main(String[] args) throws Exception {, args);


10. Run the command “mvn spring-boot:run” to compile the program, download tomcat and other dependent jar files and bring tomcat up and running with the webapp created that uses your java file to show output in the browser.

11. Open your browser and hit http://localhost:8080/ to see the response from the webapp as “Hello World!”. To access the app from a different machine in your network, use the following URL – http://auzzaman-wsl3:8080/

12. To gracefully exit the application hit “ctrl-c“.

13. Now lets make some changes to the application. For example, add a package to the class and change the text to display in the webapp a bit like below –

package com.github.ashikuzzaman.javaapichecks.spring;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;

public class AshikHelloWorldExample {

String home() {
return “Hello World from Ashik using Spring and Maven in an executable jar!”;

public static void main(String[] args) throws Exception {, args);


14. To create an executable jar first we need to add a maven plugin for spring boot. Add the below elements under dependenceies scetion in pom.xml –

15. Add an etnry if you want to change the JDK major version that you want to use. For example, if you want to specify that you want to use Java 7, here is an entry you can add just after the previous build element that you added –


16. Save pom.xml and run “mvn package

17. If you look in maven’s target directory you should see myproject-0.0.1-SNAPSHOT.jar file. You can print verbose what’s in it by “jar tvf target/myproject-0.0.1-SNAPSHOT.jar”

18. To run the application from command line, use the following command “java -jar target/myproject-0.0.1-SNAPSHOT.jar

19. Again you have to open the browser and access http://localhost:8080/

June 1, 2015

JugBD Meetup 4 – Meet the guests – Mojahedul (Masum Bhai)

Filed under: Uncategorized — ashikuzzaman @ 3:55 am

May 11, 2015

My First Java Code Commit to GitHub

Filed under: IT, Java — ashikuzzaman @ 11:46 am

My First Java Code Commit to GitHub. For now I have started with a simple class and will keep adding more classes as I get time –

I had to do some trial and error before finally all the setups worked in my Ubuntu box. You can save the trial and error time if you follow the steps below that I performed –

1. Register a github account –

2. create a repository – look at top right + sign after you log in.

3. setup authentication from github to git. You can read through this article if you need some help or simply execute the commands that I typed below in sequence – or
3a. $ git config –global “ashikuzzaman”
3b. $ git config –global “
3c. $ git config –global core.editor gedit
3d. $ git config –list
3e. $ git log

4. Clone your repository in your local workspace –  $ git clone

5. Add a new .java file, locally compile and run. For example, javac -d .

6. $ git add

7. $ git status

8. $ git commit -m “my first commit from command line to github”

9. $ git push origin master

April 18, 2015

Project Delight Go Live Party Held in San Francisco

Filed under: Uncategorized — ashikuzzaman @ 10:18 am

Last month Salesforce Global Sales and Revenue Operations held a party for Salesforce Business, IT, Vendors, Partners to celebrate Project Delight Go Live (March 9th was the go live date). Being one of the lead developers of that project, I was fortunate to be part of this celebration party. I am running towards my 8th year in Salesforce and hence have seen it grow from small to big. This party was a selected crowd from all across key participants from Sales Operations, IT, Accenture, Deloitte, Apttus executives and engineers. By key participants, I mean all the important members who have been working in this project for last 1 to 3 years to make it happen. It was held at Jones @620 Jones Street, San Francisco, CA on April 17th.

The core of the project was to replace our legacy CPQ tool Comergent with the native and fashionable Apttus CPQ. I was the lead developer for the legacy Comergent based quoting engine which is third party Java/JEE application stack deployed in Tomcat clusters within Apache. On the other hand Apttus is the application suite, the center of which is the quoting tool. But replacing a quoting tool was not the only target of this project, along with came streamlining the upstream and downstream systems and handling a large volume of desperate unstructured data accrued after years of operations. I will leave it there and get into the party part of it.

I can’t think of any other party which was more enjoyable than this. Part of the reason is the host business people are very fun loving and after working years together in this project we really got the scope to know each other very closely. There were plenty of foods of all kinds, photo taking and album creation instantly with the teams, video interviews, local musical band party of San Francisco, karaoke, a bag full of gifts (iPod Nano, Bose Bluetooth headset, iPhone charger etc were just one of the few things in that bag). You will get some idea of how much fun we had if you watch the above video of William and John dancing in the stage.

At the start of the event, anonymous peer votes were taken for 3 awards within the participants for the people who worked in this project. William Jager won the award for challenging the status quo of the project at different times, Michelle Zaus got the award for cheer leading the teams all along and yours truly got the Project Delight Nike Award for working hard and delivering quality work on time. This was very satisfying as it came from the votes of the peers. A grand project, the largest in my 15 years career, ending in a grand style.


During the party, our consultant friends who worked in this project were appreciating the party saying that no other clients’ party is like Salesforce party! Very true. I will go one step ahead and say, no other party in Salesforce was like Project Delight Party!!

April 9, 2015

Java Programmer’s Life In Music – We code hard in these cubicles

Filed under: Uncategorized — ashikuzzaman @ 8:22 am

Older Posts »

The Silver is the New Black Theme. Blog at


Get every new post delivered to your Inbox.