Pritam Panhale
5 min readOct 5, 2019

--

Java to Angular — a leap of faith.

In this article, I will try to explain what are the challenges I faced while learning UI development with Angular. I am a java developer and recently started working on UI frameworks like angular. We will discuss what me and some of my friends/colleagues have experienced while working on a UI framework especially when we are from a backend background, precisely Java. Here is a point that I found while learning angular. There are multiple tutorials available which are very good and explanatory, but I am not going to discuss what is Angular but what are basic thing I missed and what are the challenges to learn angular for a backend developer. I think this article will be useful to you if you are willing to add angular in your career path specially being a java or any backend developer.

1. Thinking –

Most of the java developers are logic oriented, definitely angular is also built in JavaScript therefore there also we need to write the code with great logical ability, but in Java we are never worried about user experience. We keen to think about core logic and its complexity. As soon as you start working on angular, we need to change our way of thinking a little bit and think from the user experience’s point of view.

2. Synchronous vs Asynchronous –

This is the biggest problem I faced when I started working on angular. The main difference is, Java is synchronous and JavaScript is asynchronous. I am not going in detail about the differences, but we will take one example. If we have to write a code in Java and JavaScript(JS) with 1000 lines which has functions then in Java you have a guarantee that code/functions will execute in sequential manner. You can predict the output of the previous line and write your next line of code with reference to last line, looks so easy and no need to worry about some special handling. In JS this get little difficult as we said it has an asynchronous behavior. If we have an asynchronous code in which you have a DB call or a HTTP request call then you cannot guarantee that your code will go sequentially rather I will say it won’t go sequentially. In JS whenever it finds an async call it will keep executing in a different thread and the original thread will jump on to next line. Here comes the big challenge, now you need to take care of that async behavior and try to put the logic around to get the desired results. This was the major challenge I face personally while learning angular. There are ‘Promises’ and ‘Observables’ available to deal with async calls. Please read it thoroughly.

3. Vision –

While writing a code in java we only have a vision to get a particular output in particular format. Even if we are using other framework with java, most of those frameworks are build in java therefore as a java developer we can easily read the code from that framework. In angular the case is little bit different, here just a knowledge of JS is not enough, but you also need to know lot more than basics of HTML and little bit of CSS. JS as language is simple and much more like java but not that rich as Java because it is not built for developing huge business logic in it.

4. Its not just learning JavaScript or typescript -

Angular is built in javasript and typescript, learning JS and typescript will help you but that is not enough. We need to learn HTML, CSS and many things about DOM. In the end angular is manipulating the DOM therefore little bit understanding of DOM will help you a lot.

5. Other related framework –

When we start learning angular we start with very basic and sometimes stuck in very basic issues like application’s look and feel, its color combination and some UI layout related issue. I suggest going with some famous framework which will make your life easy while development, for example Bootstrap for css. Use HTML 5 syntax wherever possible, use angular CLI for building your components and services. Its easy to create component and services manually but if you miss writing some basic code in decorator then it will be hard to debug, therefore initially let the CLI take care of those things.

6. Important concepts in Angular –

There are lot of concepts in angular and they all are very important and eventually you will learn it with practice. Most of them are easy to understand because decorators, classes, objects, functions, generics and other phenomenon are similar to java. But there are few topics which needs more understanding and practice like

a. Routing — We will absolutely not be going in details of routing. Routing is the best feature of Angular it makes the developer’s life easy but it’s a big area and need a good amount of time to understand it fully.

b. Forms — Great features are provided by Angular in Forms Module. Makes the developer life very easy for building the forms with easy validations. But again needs a thorough knowledge of this module.

c. HTTP — Great support is provided in Angular’s http module. As this will make your code asynchronous, this needs a great attention while writing your logic. All you need to learn about is Observables.

7. ES 6 –

ECMA Script is specification for JS, as of now it’s the latest one but in future it will keep on updating. JS is now very rich with new ES6 features. With ES6 JS has Classes, Objects, getter setters, Inheritance, Annotations, Exception handling etc, which will be easy for a Java developer to cope up with this new language. There are arrow functions which are like lambda in Java. Knowing ES6 is a great advantage.

8. Testing –

Testing becomes very easy in Angular but it is vast. You will get all the required configurations ready with the help of angular, but writing test cases need some logic, needs to know some knowledge about frameworks like Karma, Jasmine and Protractor. Angular itself provides lots of libraries to avoid boiler plate code. If you are familiar with Junit, Mocking frameworks in java then you have a good advantage.

Happy to know your point of view as well in comment box.

--

--