UML for Design Based Software Development

Before writing the actual code it is always handy to plan, and design what we want to build. There are so many ways to do so; UML (Unified Modelling Language) is one of them, and there are many types of UML diagrams, such as, Class Diagram, Use case Diagram, Component Diagram, Sequence Diagram.

In my personal opinion, writing codes without at least a class diagram seems very naive. Let’s see how class diagram can help us building a software rapidly.

Let’s assume we are given a task of reading an XML file, renaming the tags based on some given values, and generate a new XML file with the new tags. How would you map this problem!? If we just go for the coding right away, there is a higher chance of fragility somewhere during the development. So it is undoubtedly a better approach to draw a class diagram before writing the code. It doesn’t have to be precise, rather make it simple, and implementable.

aton

As we can see from the diagram above that, we need three different classes to get the job done.  And also the implementation becomes easier, reduces our future thoughts when we design a UML diagram of a solution.

 

Greedy Algorithm

Greedy approach gives a feasible solution to a problem where multiple solutions are possible. Greedy approach doesn’t give you the optimal solution, but if the feasible solution is optimal, then we can accept that solution.

Let’s consider the coin changing problem, which could be solved using greedy algorithm. Assume that, we are given a set of coins, and a sum to be changed. Then we can do so,

import math

def greedy(coins, target):
 remaining = 0
 count = 0
 i = 0
 times = 0
 while(True):
      if(target is 0):
           break
      else:
           times = math.floor(target/coins[i])
           remaining = target - (coins[i]*times)
           target = remaining
           print(coins[i]," needs: ", times," times.")
           i += 1
           count += times
 return count
coins = [10,5,2,1]
print("\ntotal coins needed: ", greedy(coins, 31))
10  needs:  3  times.
5  needs:  0  times.
2  needs:  0  times.
1  needs:  1  times.

total coins needed:  4

As we can see that, we need total 4 coins to make 31 from the list of [10,5,2,1] coins. In this case it is an optimal solution, but if we are given [4,3,1] for 6 then the total number of coins we need would be 3 using the greedy algorithm. Unfortunately, the optimal solution would be 2. So we see that greedy algorithm has some drawbacks, but it could be optimized using the dynamic programming.

Software Development Life Cycle

The termination of a software is considered to be the failure of the project. A software should be maintained, and optimized over the period of time. This is how a software turns into a technology, and that is where the success of a software belongs. In order to make a software project successful we need to follow the certain steps.

sdlc

The figure drawn above shows the essential steps of the software development in my eyes.

Further reading: SDLC

Code out loud with ….. !?

I learned number of programming languages in my life. Some of them are just for learning, some for just giving a shot, some for my career. Yet I keep my skills with programming languages very concise in my resume. The reason is simple, just to avoid horrific interview questions.

When I started learning Java back in 2010, once I heard that there aren’t many quality Java EE developers around the world. I took it for granted, and thought things won’t change that much in next 5-6 years. But unfortunately by the time I came out of university, I found everyone around me speaks Java EE. And the experience ones in the interview board really hate the way a fresh graduate codes (no design patterns, smelly codes, less cohesion, high coupling, redundant codes, and so forth).

Along with some other reasons I decided to pack my bag once again for a higher degree, and take a relief from the dog fight in the job market. Once in a spare time I started looking through the list of the programming languages, and tried to find one for myself. I would say python really attracted me, not because it was easy, rather I realized not so many people around the world actually use it professionally, unless they are engaged in a scientific computing. Eventually I got a chance to work for a high performance computing center, and I really did use python ;). I felt like, job, finally I got you bitch.

Nevertheless I still love java, and used it professionally too. But, python holds my first place of attention.

Spring boot and ME

My experience with spring boot is rather brief. I learned spring boot for 3 months in my last job. that’s it. Whenever I am asked to learn any new technology I look for its total dimension, for instance, the annotations it provides in total, or the proper way of configuring it, or the best available practice in the market. For being open-source spring community is quite active, and very much deliberate therefore you don’t have to strive that much to get the things roll on. In this post actually I have nothing to share much except leaving the spring boot reference card,  and a personal feedback on this framework, which is very positive indeed.

JavaEE annotations

javaee cheat sheet

Annotations are the backbone of Java Enterprise application development. Annotations follow the decorator pattern. Hence they provide the higher level of abstraction in the code, and helps making the application more loosely coupled, and modularized. Even though the list of built-in JavaEE annotations are quite big, nonetheless we can find commonly used annotations off the sheet posted below.

Built-in JavaEE annotations : JavaEE annotations

Special Terms:  Interceptors, Decorators, Stereotyping