Thursday, June 18, 2020

Javing is now on Medium too.

Dear readers of Javing. Recently I decided to publishing also on medium. Don't worry I will never stop publishing here but the reason I decided to expand to the also popular medium platform is because it would increase the visibility of my company. I would kindly ask you if you are a regular reader of Javing, to please follow Javing also on medium. This is the link to the Javing profile on medium: https://medium.com/@javing.uk once you get there you should see the follow option.

Also I would like to thank you all for reading my articles during all this years and I am looking forward to continue Javing for many more years.

Warm regards to everyone.

Sunday, June 7, 2020

Ubuntu aliases backup

Just some of the aliases I use more freequently. I thought to back them up here in a blogpost.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# alias management

alias a='alias'

alias ae='nano ~/.bashrc'

alias s='source ~/.bashrc'



#docker

alias dR='ds;dr;dp;dip;dri;dl'

alias dc='docker-compose up -d --build'

alias de='sudo dockerd &'

alias di='docker images -a'

alias dip='docker images purge'

alias dl='docker ps -s -a'

alias dn='docker network create'

alias dp='docker system prune --volumes && docker network prune'

alias dpa='docker ps -a'

alias dps='docker ps -s'

alias dr='docker rm $(docker ps -a -q)'

alias dri='docker rmi -f $(docker images -a -q)'

alias ds='docker stop $(docker ps -a -q)'

alias dst='docker start'

alias gdc='g;dc'

alias gx='./gradlew build -x test'



# gradle and maven

alias g='./gradlew clean build --rerun-tasks --no-build-cache'

alias gt='./gradlew -q tasks'

alias mci='mvn clean install'

alias mc='mvn clean'

alias mcp='mvn clean package'



# java

alias homej11='export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/;echo $"JAVA_HOME set to:";echo $JAVA_HOME;s'

alias homej8='export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/;echo $"JAVA_HOME set to:";echo $JAVA_HOME;s'

alias j11='sudo update-java-alternatives -s java-1.11.0-openjdk-amd64;jv;homej11'

alias j8='sudo update-java-alternatives -s java-1.8.0-openjdk-amd64;jv;homej8'

alias jv='java -version'



# other

alias l='ls -CF'

alias la='ls -A'

alias ll='ls -alF'

alias w='cd ~/workspace'


Saturday, May 23, 2020

docker-compose: setup of spring boot app and it's dependant services

In this video I show how to create an image of a spring boot app that was previously built with gradle and use that image alongside all the other services it depends on. Docker compose is a very useful tool that can help us reduce the complexity of configuring services to be run on docker.


Wednesday, March 25, 2020

Tuesday, March 24, 2020

Monday, March 9, 2020

Test creation order

Just digging into some old papers today, I found this old note. I think I did screenshot this long ago from a video by Sandro Mancuso. 

1. Class name: The class name is post fixed with Should. This is a pattern that was introduced by Sandro in his lectures. Since tests are probably already in the test package, we don't need to know post fix them with the word test, this class name is more BDD friendly and serves as good documentation.

2. Method name: Is concise and it explains what it does without revealing implementation detail. The words are separated with underscore so that it is easier to read than camel case in a first glance.

3. Assertion written first: By writing the assertion first we reduce the risk of introducing assumptions and over engineer. It helps keeping the code minimal and growing it progressively.

4. Action: Once  e have our assertion we will write the action. This maybe seems counter intuitive
but as you will notice, as we are writing the assertion and the action, the code is not compiling, this will force us to code the minimum required to make the test compile.

5. Setup: The last step is to add the setup. With this approach we forced our brain to focus on the behaviour and not on the state. This focus on behaviour is the key for growing the code gradually. Thinking on state first rather than behaviour can lead to assumptions and missed requirements.

This is a very interesting approach which has a lot of benefits. What do you think?

Share with your friends