My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
My First Day With Spring!

My First Day With Spring!

Akshay Makkar's photo
Akshay Makkar
·Feb 3, 2020

Today was the second day of semester. We had a full day class on MiddleWare Frameworks and Object Relational Mapping (MF & ORM).

We had an industrial expert coming to teach us. It was a great learning experience for me today as we haven’t been taught in such depths about Java and its basics. I am looking forward to an exciting journey with Mr. Amit.

Here are the things which we learned today:

S.O.L.I.D. Principle — It is a set of principles that one must follow while coding to write a clean and reusable code. S stands for single responsibility principle which means that a class should be whole in itself and should do only one task. O stands for open/closed principle which means that any entity we make should be available/open for extension but closed for modification. L stands for Liskov Substitution Principle. We weren’t told this today. (Sorry I can’t explain yet). I is for Interface Segregation Principle. It means that two classes will always communicate via an interface so that we have a choice what to expose to the other class and what not. D is for Don’t Repeat Yourself. If you ever copy paste your code in your project, you are not a good coder.

Writing new ClassName(); is a CRIME in Spring

Next we covered the aspects of interface, multiple inheritance and abstract classes. Multiple Inheritance in classes is not supported because of constructor chaining and ambiguity. Interfaces solve those two problems as the methods are abstract, the variables are final, and there are no constructors. This was applicable till Java 7 but in Java 8 it became possible to declare methods with body inside interface using the keyword ‘default’. So the problem of ambiguity arose again. This can be tackled by overriding the ambiguous function and calling respective methods.

Post that we learned about how to actually write a loosely coupled code that is strongly cohesive.It means that an entity should not be dependent on some other entity with some tight relation such as directly making its object. (One line which I won’t forget here is that — “Writing new ClassName(); is a CRIME in Spring”). We solved the problem of tight coupling in core java only by the use of interface, a factory class and config.properties file.

Having the fundamentals cleared, we then understood what exactly is a Framework and what how does it help and what exactly are enterprise level applications. For instance, the FinnOne Neo provided by Nucleus Solutions to banks for Loan Management.Then we installed Spring 5.5 release and started development in Eclipse. We picked the same problem statement that we solved using core java, this time with the use of XML file and ApplicationContext() class.

First day was really exciting. Towards the understand our instructor made us aware about the opportunities for developers in the market. If one has quality in his work, companies are ready to pay the price for them.

PS: This is my first such long piece of content on the internet. I hope with this start I will be able to write better in future. Also, just to clarify, the purpose of these stories will be to help me revisit the concepts everyday as I learn and to provide whatsoever the value I can to this community. I will be uploading these on every Tuesday.

Also, I am looking to write more apart from this series, something non technical stuff. Let’s how my journey goes!