Martin Fowler and James Lewis have an article on micro services here http://martinfowler.com/articles/microservices.html
Though my first reaction to it was, “what, isn’t this SOA”, the article itself had a sidebar which mentioned “service orientation done right”.
Worth a read, Excellent stuff as usual from thoughtworks folks.
To some extent, I felt Martin Fowler is taking an U-turn on
Hence, we get to my First Law of Distributed Object Design: Don’t distribute your objects!
How, then, do you effectively use multiple processors? In most cases the way to go is clustering (see Figure 7.2). Put all the classes into a single process and then run multiple copies of that process on the various nodes. That way each process uses local calls to get the job done and thus does things faster. You can also use fine-grained interfaces for all the classes within the process and thus get better maintainability with a simpler programming model.
Quote from Patterns of Enterprise Application Architecture (PoEAA) Chapter 7 Distribution Strategies.
- I am aware of the terms that Fowler uses here “Objects” – I always thought he used objects here in the sense of component objects / service objects – Earlier in this chapter he uses “With separate remote objects for customers, orders, products, and deliveries. Each one is a separate component that can be placed on a separate processing node.” So I believe he uses object in a broader sense in the First Law of Distributed Object Design.
- Granted today we have a faster network stack
- His argument about coarse grained interfaces was spot on.
- Also I understand the benefits that micro services brings.
I think, he that he should rewrite his Distribution Strategies Chapter in PoEAA to include the micro services alternative as well.
Every application has various concerns. One classification of these concerns is application infrastructure concerns and business concerns. The business concerns are specific to an application and differ with each one of them. On the other hand infrastructure concerns are somewhat similar and with right parameterization we can reuse them across applications.
Various libraries and frameworks exist in any technology space to help us with the infrastructure concerns. Writing infrastructure code is (when it is solved by someone else already) is stealing from your employer / client (http://codebetter.com/jeremymiller/2008/11/07/how-to-design-your-data-connectivity-strategy/)
- Routing, Navigation & History
- Template Engines
- Communicate with the server to read / update the model
- Responsive Web-design
- DOM manipulation
- Asynchronous Programming
- UI Widgets
- Feature detection
Another level of reuse is the reuse at the conceptual level / design level / idea level. Frameworks excel in this form of reuse. Frameworks are opinionated. They enforce or provide some default architecture / structure to your application. Frameworks have inversion of control. That means frameworks may enforce a life-cycle and typically the framework calls your application code and not vice versa.
UI Architectural patterns are all about Separation of Concerns and having more maintainable code – Divide and Conquer. Frameworks may typically follow (an) UI Architectural pattern(s)
Let us now see how angularjs helps in Code Organization and Infrastructure concerns
What is AngularJS?
I will use and elaborate a slightly modified version of Amit’s answer to What is AngularJS? When is it needed? on Quora http://www.quora.com/What-is-AngularJS-When-is-it-needed/answer/Amit-Asthana
Let us see each one of these
Angularjs code you write typically falls into one of these buckets
If you are talking to the outside world, this is a perfect use case for a service – from (http://nathanleclaire.com/blog/2014/03/15/angularjs-isnt-mvc-its-sdc/)
Directives are a declarative (Some call this functional, but i believe this is declarative) way of manipulating / working with the DOM. The Web standards too are polarizing in this direction – Example: Web Components. Directives are one of the key aspects of angular (often misunderstood and under used)
Directives are either completely new HTML elements, or attributes that you can throw on existing elements, to perform some kind of DOM manipulation. They can have their own scope and they can be reused, which is one of their most useful properties. – from http://nathanleclaire.com/blog/2014/03/15/angularjs-isnt-mvc-its-sdc/
The html templates written using angularjs directives and standard html elements
Angular lets you write non intrusive POJO model objects. Angularjs implements its own dirty checking http://stackoverflow.com/questions/9682092/databinding-in-angularjs/9693933#9693933 which means you can write your models as POJO objects, but it does come with a performance hit.
“glue” of your application. Controllers use model (methods and data) provided by the services and provide them to the directives. – adapted from http://nathanleclaire.com/blog/2014/03/15/angularjs-isnt-mvc-its-sdc/
Angularjs is designed for ease of unit testing. It is made easier by
- Dependency Injection
- Standard Mock Service Providers
The whole of Angular is linked together by Dependency Injection (DI). It’s what it uses to manage your controllers and scopes. Because all your controllers depend on DI to pass it information, Angular’s unit tests are able to usurp DI to perform unit testing by injecting mock data into your controller and measuring the output and behavior. In fact, Angular already has a mock HTTP provider to inject fake server responses into controllers. – from http://www.sitepoint.com/10-reasons-use-angularjs/
See the discussion on directives above.
In addition to these angular provides solutions to these infrastructure concerns
- Template Engine – Angular provides a DOM based template engine.
- Data-binding – Bidirectional reactive data-binding
- A context aware pub-sub system
- GUI widgets
- It will be interesting to see Polymer custom elements and angularjs directives against each other.
நல்லதோர் வீணைசெய்தே – அதை
நலங்கெடப் புழுதியில் எறிவதுண்டோ
சொல்லடி சிவசக்தி – எனைச்
சுடர்மிகும் அறிவுடன் படைத்துவிட்டாய்
வல்லமை தாராயோ – இந்த
மாநிலம் பயனுற வாழ்வதற்கே?
சொல்லடி சிவசக்தி? – நிலச்
சுமையென வாழ்ந்திடப் புரிகுவையோ?
விசையுறு பந்தினைப்போல் – உள்ளம்
வேண்டிய படிசெலும் உடல்கேட்டேன்
நசையறு மனங்கேட்டேன் –நித்தம்
நவமெனச் சுடர்தரும் உயிர்கேட்டேன்
தசையினத் தீசுடினும் – சிவ
சக்தியைப் பாடும்நல் அகங்கேட்டேன்
அசைவறு மதிகேட்டேன் – இவை
அருள்வதில் உனக்கெதுந் தடையுளதோ?
Source and Credits: http://www.kamban.com.au/literarytexts/barathiyar.txt
6 years ago, I blogged about Career Path. Today I would like to revisit the same. What prompted this? There was this interesting discussion on hacker news – What happens to Older Developers?. It is a very interesting read.
Who is a older developer?
People in the thread seem to agree 30+. Going by Peter Norvig’s classic Teach yourself programming in 10 years, the magic number seems to be 10 years / 10, 000 hours. Assuming you started your career after college (around 21), Around 31 you should have mastered the art of programming (assuming you wanted to master it).
What next? Revisiting Career Path
I would like to revisit career path in some new light. This are the options that I currently think are valid.
Yes, I have added the Independent option now.
It is not an either, or between the dependent and independent, you can be on the dependent side to bootstrap your independent venture initially. But have a clear choice in mind. I will quote again the same anecdote from my older post.
A disciple asked a Master about what books he should read.
The Master asked him ‘What do you want to become?’
Disciple said ‘I don’t know’.
Master replied back "Then it doesn’t matter which books you read"
If you do not have a personal vision you cannot lead others effectively.
Throughout life people will make you mad, disrespect you, and treat you bad. Let God deal with the things they do, ‘cause hate in your heart will consume you too.
– Will Smith
Source and Credits: https://plus.google.com/116330375433045461044/posts/JVHsaJiCtHr
Here is a short anecdote on critics, criticism.
Long time ago there was a great king in the Raghukul dynasty (Lord Rama also belonged to the same dynasty). He was suffering from leprosy. He fell on the feet of his master, Guru Vashishtha and said: "Oh Master! So much of suffering… ?"
The master kept his hand on his eyes and asked him: "Look far. What do you see?"
"A huge sparkling golden mountain. And another black coal like mountain."
"One is the mountain of your good karma which gave you your kingdom, richness, power & fame. Another is the mountain of your sins because of which you have the painful disease, worries & troubles."
"Master! Is there a way to get relieved of these?"
"Eat up that mountain."
"Oh lord! Eating that mountain is out of my control."
"Then eat up the pile of garbage lying behind your palace."
"Oh great soul! I will not be able to eat that. Please tell me a simple way."
For a few seconds Guru Vashishtha made his mind peaceful and thought of a solution and said: "Sleep in a bed placed near main door of the palace of your widow sister-in-law everyday at 6:00 PM."
The king of Raghukul dynasty… In the palace of widow sister-in-law… ? What will people say? But there was no other solution. The king did as his master told him. Whoever passed by commented on the bad character of the king and humiliated him. People even used abusive language. At ten o’ clock in the night the king silently went back to his palace. The next morning he saw that a part of his body was cured. The next day the disease was further cured. In this way his body was getting cured day by day. His mind was also more peaceful now. On the fourth day Vashishtha ji kept his hand over his eyes and asked him to see again. This time he saw that the golden mountain of good karma was as big & sparkling as earlier but the black mountain of sins became very small.
Vashishtha ji said: "All those who spoke ill about you & criticized you have taken the portion of your sins. Now they’ll have to suffer the consequences of your bad karma. You have become pure."
After two days that black mountain was reduced to a small pebble. The king was totally cured except for a small mark on his face.
"Oh Master!The big mountain has vanished and a small pebble is remaining now. There is a small mark on face now and a little grief in the heart."
"The remaining part is mine. Why should I commit the sin of criticizing & blaming an innocent & pure man and then bear the consequences? You bear the remaining yourself."
Moral of the story: Never criticize anyone, When someone criticizes you, thank them, for they are taking your bad karma away.
Source and Credits: http://www.reocities.com/Yosemite/2021/spirit_stories/critic.html
“In a Bright morning, much like in Spring, i was on a vacation with my family in Allahabad, i was walking near the coasts of Sangam river and I saw, what to many people call as Aghori. Like many people do, i also had a few pre beliefs about Such kinds, and i was scared to talk to him.
But in curiosity i just approached him, and i said, “Jai Shiv Shankar” and he was actually humble enough to reply, and said “Har har mahadev”. And since he replied to my first act, i was sure that we can now have a small little chat. I asked “Many people Have many beliefs, Misconceptions probably about you and all the ones that have accepted this path of life, what do you think about them.?”
His answer to this question, i am never going to forget, he said “It dont matter to us anymore, we have attained, to what many of you define as PEACE in life.” And out of curiosity, i had to ask this question, “What is according to you the true and most amazing/spiritual way to attain Peace?”
He stated, “Dear one, you may have many beliefs, misconceptions about me, but here is how you can have peace:
- Make peace with your Past, so it doesn’t Spoil your Present.
- What others think of you is none of your Business.
- Time heals almost everything. Give the Time, sometime.
- No one is the reason of your happiness, except you yourself.
- Don’t compare yourself to others, you have no idea of what you journey (Life) has for you ahead.
- Stop Thinking too much, its ok not knowing everything.
- Smile, you dont own all the problems in the world.
Leave your thoughts/comments/questions about our way of living. Though i am just an another soul that exists around you, i have practiced this style of living all my life. And Honestly i call it a Spiritual life.
Source and Credits: https://medium.com/what-i-learned-today/e410f9724fa3
Image Courtesy: Google Image Search & Twitter –https://twitter.com/zsiti/status/333510958473416704/photo/1