Friday, August 28, 2020

Node JS Developer Training!


Node.js is a runtime platform that executes Javascript code outside the browser.  It allows Javascript to be used on the server side and also for command line tools.  Running scripts on Server Side helps you build a dynamic web page.  Node has an event driven architecture that gives you asynchronous I/O.  Node is a powerful technology that help you build real time web applications.

The following topics will be covered in the course:

- Event Loop

- REPL

- async await

- Node JS API

- Node-Fetch

- Event Emitter

- Web Sockets

- npm Packages

- Semver

- npx Commands

Thursday, July 30, 2020

Unit Testing Training with Javascript (React, Redux, and Angular)



Unit Testing Training with Javascript (React, Redux or Angular)


Learn how to do TDD and BDD with Javascript. Jest and Enzyme.  Do Snapshot Testing. Play with React Hooks.  Test Redux Thunk Code. Write Integration Tests and more.   Please call us if you are ready.

Tuesday, July 28, 2020

Micronaut developer training


Micronaut is a simple and powerful framework for building Microservices.  Code simplicity and developer productivity are the highlights of Micronaut development.  Our hands on work shop and training will cover the following topics:

- Microservices Architecture
- Introduction to Micronaut
- Controllers
- Routing
- Validaton
- HTTP Client and Validation
- Using JSON
- GORM and Deployment

Participants should be comfortable with Java and code fluently.  This would be a completely hands on workshop.

Please feel free to reach us if you need to train your team on Micronaut.  We look forward to hearing from you.

Friday, June 19, 2020

10 Dos and Don’ts for getting started with Microservices

Too much noise about Microservices but still scratching your head where and how you can start? Here are the 10 Dos and Dont's.

  • Choose a simple/non-critical feature in your application, that you can afford to burn your fingers several times. Choose something like a Change Password functionality. You can develop the complete change password behaviour that involves validating the old password, accepting the new password, encrypting using BCrypt and Salt and storing them in the Database.
  • Don’t bother too much about the presentation layer. Concentrate on the core functionality and talk to the service using HTTP and exchange simple JSON data. Worry about WebComponents, Virtual DOM and the like later on.
  • Don’t develop it using the mothership technology of your project. If your project is implemented using RoR or .NET or Java implement the service using a technology other than these. For example, if your main application is built on Rails, use Spring Boot to implement the services. You can also use NodeJS.
  • Do not write more than 100 hundred lines of code to begin with. Remember it’s a microservice. Don’t make it a macro service and grow to be a giant. And that’s why we have chosen a small feature in first place.
  • Use a simple IDE like TextMate or Sublime Text or just Notepad++. Why do you need a mammoth editor that takes 5 minutes to open? In that 5 minutes you could easily complete half the service. 
  • Don’t worry about the Message Queues like RabbitMQ, Kafka etc., Do not complicate your service in the beginning itself. Keep it Simple, Stupid.
  • Learn Docker. Period. 
  • Throw away your Windows machine. Now, that’s very harsh!!! But if you want to jumpstart developing a service and quickly deploying to the cloud, please move away from the comfortable territory of Windows. Pick up a Mac or buy an Ubuntu or any Linux machine and start working.
  • Stop reading too many articles in this topic after some point. Just go ahead and implement it.

Tuesday, June 16, 2020

Kotlin - Decompiling Null safety operators - Part I (Using Java Decompilers to understand null safety operators in Kotlin)

We were recently writing some code using Kotlin programming language. After finishing the task, one of our friends glanced at the code and quipped, "Is question mark a first class citizen in Kotlin?". We took a step back and looked at the code dispassionately for a second and couldn't stop smiling. Please take a look at this code snippet in Kotlin.


	var tower = resultMap[code.trim()]
	tower?.occurences = value
	var weight:Int? = resultMap[code.trim()]?.weight
	nestedTower?.subTowers?.add(Tower(code.trim()))
						

You will notice a number of question mark (?) operators used here. Kotlin, the new language on the JVM, is getting popular with null safety operators being one of the reasons. The question-mark(?) operator also known as the safe navigation operator is not entirely new to programming languages. It's a commonly used one in languages like GroovyC# etc., for a long time. Kotlin introduces this safety operator and extends it with a couple of more operators in the safety front. 

Kotlin

To being with, let's understand the difference between the two types of declarations in Kotlin as shown below.


	var anInt:Int = 10
	var anotherInt:Int? = 20						
					

For the Java-only eyes, the declaration of anotherInt is bound to bring your brows together. anInt is a normal integer variable. anotherInt is also an integer variable declared using Int?Int? means, an integer value or null. So you can now assign null to anotherInt like this.


     anotherInt = null
							

anInt cannot be assigned to null, however. So Int? can be read as either integer or null. 

Decompiler speaks

Let's take the following Kotlin code written in Types.kt file and compile it


	fun main(arg:Array){
		var anInt:Int = 10
		var anotherInt:Int? = 20
		println(anotherInt)
		anotherInt = null
		println(anotherInt)
	}
	

We get TypesKt.class that you want to decompile. Let's use  JDPro in http://www.javadecompilers.com/. Here's what the decompiler gives us.


public final class TypesKt { 
   public static final void main(@org.jetbrains.annotations.NotNull 
   String[] arg) {
     int anInt = 10;
     Integer anotherInt = Integer.valueOf(20);
     System.out.println(anInt);
     System.out.println(anotherInt);
     anotherInt = (Integer)null;
     System.out.println(anotherInt);
  }
}				
				

So, the Kotlin compiler merely treates anotherInt? as a reference data-type, by using the wrapper class, Integer. Hmm! That's interesting. You will also notice that, since Kotlin is very strict about null-safety it injects @NotNullannotation to the command-line arguments arg. How about a safety operator on a reference data type like say a String?. Let's add these lines to the mainfunction in Kotlin and see what we get.

	
	var normalString:String = null
	var safeString:String? = null
	println(normalString)
	println(safeString)
	

Compiling this code will report an error that says, 

error: null can not be a value of a non-null type String
var normalString:String = null

Kotlin, just doesn't allow null values even on reference types declared in the normal fashion. Remember, in Java the following line of code compiles without any error

String normalString = null;

Decompiler speaks

Let's decompile the following code in Kotlin and see what it has to say.


	var normalString:String = "Normal string"
	var safeString:String? = "Safe string"
	println(normalString)
	println(safeString)
							

The decompiled code looks like this


	public final class TypesKt { 
		public static final void main(String[] arg) {
		 //...
	     String normalString = "Normal string";
	     String safeString = "Safe string";
	     System.out.println(normalString);
	     System.out.println(safeString);
	   }
	}
								

Since the Kotlin compiler performs the null checks, the decompiled code looks very similar to a regular Java piece. 

In the next part we'll take a look at accessing methods in a safe way and get introduced to couple of other operators.

Two services talking using NodeJS and Ruby, Sinatra.

There are a number of ways to make services or applications talk to each other. You can make one service access another service synchronously or asynchronously.

Usually two services can talk to each other each other using databases, or plain HTTP or using message queues. Message queues are used for asynchronous communication. 

Here's a short video that shows two services, one created using NodeJS and the other created using Ruby, Sinatra. NodeJS service uses axios HTTP library to access the Ruby Service.



Friday, June 12, 2020

Learn Go Language - Basics to Advanced Videos


Go lang

  • Language from Google
  • Natively compiled to machine language
  • The design is to restrict the language to have not more than 25 keywords
  • Not object-oriented
  • Docker, Kubernetes, Consul are built and based on Go
  • Statically typed, garbage collected
  • Open source
  • Has pointers, but no pointer arithmetic like C
  • Built-in concurrency model with Goroutines, channels
  • Concurrency is managed by the Go runtime unlike other programming languages where the OS kernel takes care