Monolithic vs Decoupled Schema



Let us understand what we mean by Monolithic and Decoupled architecture, Schema with an example.

Setting up a library

Let us take example of library. A new library is opening up. It would have many books, may be on various subjects. First task for librarian is, to store the books in library.

Librarian started with obvious approach first, i.e. start putting all books in shelf, one after other. It was quick. She puts all the books quickly in the shelves; and created an index to search any book.  




Benefits:
  • -        It was quick, easy, and less work. Just one simple storing strategy, every new book will go to next available space.
  • -          You have all sort of books at one place, which means just keep updating one index for every new book – no need to maintain separate indexes.
  • -          Readers can find all sort of books at one place for all of their tastes. They need not to go to multiple places. Just iterate over and you will find what you need.
  • -          For librarian, access management is easy. Anyone having access to library, can access any book easily. Less time spent on management.
  • -          It is easy for readers to refer any other related book also. For ex: if you reading astronomy book, and need to refer a math book. It might just be somewhere in same row.

All setup done. Things started rolling. All good so far. Eventually library become popular and started getting more readers and requirements for new books. Librarian started ordering more and more books on various subjects.

Challenges:

However, as volume of books increased, Librarian started observing few issues. Like:

  • -        Readers: Mostly readers have interest in one or two categories of books. They just look for these, and not for diverse set of books.

o   However, as all the books are placed in one bookrack, it was time consuming for readers to look for relevant book, and to understand the whole big library index.
o   They were spending more time on searching the right place of information, rather than reading the actual information.
o   Few of the readers started logging their frustration too.

  • -          Readers & Librarian: Whenever there is a new lot of books or existing are getting old in library, librarian need to rearrange the books. Because it was one single category, it means that whole index chart needs to be updated every time.  

o   Readers: It was demanding for them to learn new changes again and again due to the size of library, even when they are not really reading books from affected categories. They are spending time to readjust to new changes, even when they are not really related to that change.
o   It was also demanding more time from librarian, because whole index chart needs update, more work.
  • -          Librarian: Once library founder ‘the one who is investing’ asked to put some books at priority window, librarian has to obey. But, as there are lot of books, many readers, she was very busy and was really out of time to update the whole index.

o   As there is a single inventory or index, librarian either need to change the whole index of all books, or will keep it dirty for whole set of books.
o   She fall back to second option of keeping it dirty to follow the orders. But that means index is disturbed for whole library. Would have been limited to  one category, in case if we have categories.
  • -          Librarian: Reader A comes and ask for a book of history.

o   It took librarian bit of time to look for that specific book. Reason, even if we have index, but the index itself is huge.
o   Librarian, being a human being, is limited by her own capacity to go through with that massive information of indexes or domain knowledge.

Gradually librarian figured out that current structure is becoming difficult to manage. She learnt from these findings and rearranged the books, this time based on categories.


Revised structure

Now library has various racks named based on category of books, like Math, Science, Management, Astronomy, History, Finance etc. A comparatively much smaller index is maintained for books, which become easy to remember, recall. Even a smaller index is maintained for racks as well.




Results, with this one change, most of the above challenges were resolved.  
  • -          Readers were very happy as they were able to find a book quickly and easily.
  • -          Librarian is also happy now as it reduced her work a lot, lesser long queues. She can respond to changes quickly with lesser impact area.
  • -          Any new Reader can easily understand the structure, as it is smaller.

Overall, lesser work for Librarian and Readers both, More productivity and quality time spent on real work which is studying.

Ball starts rolling, things were moving good. Gradually librarian figured out more points.

Added benefits:
-          
  • For Readers:

o   Readers are spending more productive time on doing actual reading. Earlier they kept on waiting for where to find the right information.
o   Readers can refer to index themselves easily, as it is much smaller and easy to navigate now. Earlier they were mostly confused and were keep on waiting for librarian for every new need.
§  Whole system is moving towards self service mode, reducing dependency on one point.
o   New readers, who mostly focus on one category of books, were able to understand the index fast – even if they are lesser experienced in library system.
§  Reason, information is in much smaller pockets for them to digest.
o   One great silent point for improving productivity, earlier readers use to distracted by non-related information also easily as it sits next to the main book. They usually spend lot of time just looking at books i.e. lesser focus on main reading.
§  This was improved a lot, as now there is no obvious scope of cross-referencing and distraction. Much cleaner approach to study.
  • -          For librarian,

o   Changing the index structure based on any special need, become much easier, due to size and reduce dependencies.
o   Index system also become much easier, as it is designed for one specific category, for specific needs of that category. 
§  Lesser collisions, or smaller size indexes.
o   It become easy to manage the changes, and the after impact on readers. Change in one category was not impacting the readers of other categories.
§  Lesser waste of time on managing emotions and complaints.
o   Maintenance activities like Tallying the books and indexes become easy, as now librarian can do it category by category, instead of going big all the time.
o   Any dirty work due to any special need was limited to one category only, was not impacting the whole system.

Innovation, Evolution to next Level

What more, as changes can be contained to one small section of books now,
-        
  •   Librarian even found it easy to experiment various new technologies now.

o   Ex: Librarian noticed that Readers of computer category were mostly asking for e-books, CDs. She decided to experiment and brought in an E-books system for computers with audio devices, replacing hard copies. It saved space. Readers were also happier.
o   This change was only possible because change was limited to one book category, one rack. Librarian may never experiment this, if it has to be done for whole library.
  • -          Once computer’s books moved to e-books system, librarian even moved ahead to make it available 24 hours by exposing it on internet.

o   Rest of the books still accessed in manual mode, when you are in library physically.
o   Hence, it become possible now for each category to have its own protocol of access, without having dependency or impact on other.
o   Increased scope of innovations, experimentation


Challenges and Solutions for Revised Structure

There were very few cases when previous system of mixed categories seems better, like:
  • -          Some experienced readers, who usually cross-reference, and read more than one category of books, find it easy to have all books at one place, as it was easy to pick the books.

o   Solution was to make indexes handy so that they can quickly refer to other categories.
o   And a little efforts on educating that new system is easier for bulk of the readers and for maintenance also.
  • -          Some experienced readers were not finding it easy, as they need all related books at one place to read easily.

o   Solution: Check for specific use cases of these users and make a special rack which contains all of such taste books (may be a copy).
  • -          Auditors question was, how can I see the all the books in one go now, overall books auditing.

o   Solution: Books are still there in library, the only change is the rack. These racks are placed next to each other and are approachable whatever way it can help.
o   Further, we can copy and paste index or usage data of all the categories at one place to refer.

All of these challenges also mitigated gradually. Overall, librarian, Readers, Management, Maintenance staff, all are happier now with a change in how we store the books.

Now let us refer back to terms to map with Software Development:
-        
  •   First library system > Monolithic Architectural pattern
  • -          Improvised library system > Decoupled pattern
  • -          Librarians > DBAs, Developers
  • -          Readers > Developers, Micro-Services
  • -          Auditors > Business users
  • -          Experienced Readers > Users who are using this system since long and are well versed with this structure.  Who are much experienced in system over the years and hence can remember and process all of information effectively.

* Credit goes to my wife, the co-blogger, for tossing this example :) 

Own the Problem and Solve It

Problems are problematic and sometime so much problematic that this demand last pint of efforts from us and still challenge us more. But, problems are part of life and will continue to be there. Hence only way to deal with problems is to 'Deal' with these.

One of the common phoenomenon I found is, we are more worried by thinking about problem than actually by the problem. We keep on thinking about problem, by doing all permutation and combination for all possible scenarios, outcomes, what if situations, and get defeated multiple times even before facing the actual problem. Seems, this is more problematic than actual problem. This mentality or habbit (quite common, you are not special) creates more pain for us than what actual Problem can do. We keep on struggling with these problematic thoughts for days,  months or years sometime, but won't take a step to solve it. Result, many a times, we are making a Mountain out of a Molehill or a Bigger Mountain from a small mountain, or pushing our head against that Mountain rather than to take a step to side and walk around this.

Why we do this. What is the solution.

Let us address it step wise. We do this because many a times, we stuck in a loop of thinking, anticipating, visualizing, fearing and the repeating all again. We don't take even a single step considering that result won't be good. We have high inertia.

What is the solution. Solution is to take first step towards solution. We all have solution. It may not be perfect, or may not be the right one.  But we all have capacity to think about solution. So taking step towards solution is the only way out. It is perfectly fine to make a wrong decision. However, it is good as long as we have courage to review it and change our course of action. But what absolutely wrong is, if we don't even take a step. So the solution is to own the problem, think about solution, pick the best from your options, and start executing. If it is right, your problem will be solved. If it is not right, at least you will learn to take next step.

Problems are part of life, and will continue to be there till we exist. Problem free life is not a reality and is not going to be happen. However, a life with solutoins for problem is feasible. So strive for that. And only way out is, Own the problem and take first step to solve it.

What is In-Memory Database Management System

In Memory Database is a fascinating field for a programmer, for an architect, and for technology leaders. Let us try to understand in this article, what is In-Memory DB and why are these so useful. 

As a programmer, designer or architect, whenever I work with traditional databases, one major area to be conscious about is, that database access should be designed carefully. This is because traditional database system store everything on disk, and hence any access or update to this data could be one of the slowest operations in application flow. Undoubtedly, a lot of research and improvements have been done to improve the performance of disk based database systems with improved storing, searching and retrieving logic. Still, disk access, being mechanical operation, always have limitations. And this is one of the important reasons to be fascinated about in-memory database systems. 

Visualize a system where all data (or all data required for curernt context) is sitting in memory. Which means, we can expect a lot more efficient and faster access to data. Database software can have much simpler logic to manage the data, as there is no need to manage the loading/unloading of pages in memory. There is no need to work on time taking locking mechanism to safeguard the data on disk, as access in memory is much faster and chances of conflicts are extremly small which change the way we design database system algorithms. It also means that we can exploit the best available CPU power (which is increasing continuously) to process the data available in memory, having no limitation of disk access. This could also mean that there is no need of another layer of caching system. Rather, database itself will be working like in-memory cache. There are many more benefits if we design the system considering in-memory database system. 

Let us understand what is In-Memory Database System (IMDS). It is a DBMS which maintain all data primarily in Main Memory. Data will be loaded in memory even if it is in GB or TB. A few highlights:

    With 64 bits computer architecture, systems are capable to address 16 EB of data (1 TB * 1000 * 1000). 82% of the enterprise application’s databases are below 1 TB, growing with an average speed of 10% per year, which means that In-Memory database systems can cater to most of the applications now and in coming future as well.  
    Does not need write or read to Disk, hence no dependency on mechanical parts and their performance limitations. When all data is stored in single address space, it reduces the complexity of storage algorithms, no need now of loading and unloading the pages in memory
    Much faster than Disk based traditional DBMS. Having all data in memory means that data is available at our finger tips, only microseconds or nanoseconds away.
    And it supports ACID properties of Database, including D (durability) 

Attitude Builds the Great Products

During starting years of my career, I was interviewed by a start-up company. Recruitment manager (read CTO) explained me some complex product idea and asked, "Can you implement it". I was not able to understand those complex pieces completely (being slow by nature in new writings :) ). I replied, "I am not very through with whole thing. However, if it is logically feasible, we can do it for sure." And I was hired.

The product concept and the technologies were very new for the team. It was a uphill learning task. Team average experience was around 5 years (excluding the manager). Still team had done wonderful job. With a team of 10 people, we developed a beautiful product with many complex and feature rich components that also in months’ time frame. Whole system was developed on self-validating test workflows, following TDD kind of advance methodologies which were very new and challenging for that 'junior' team. We challenged our every existing belief and drew new lines on learning graph every day, while producing some very interesting product pieces. Definitely, there were many environmental factors which contributed to this wonderful work. However, one of the main factors was the right attitude and willingness to accomplish.

Later, I asked my manager that how he selected me without even asking much technical question. He replied, "I have looked for right attitude in all the candidates and that paid us well".

Other experience: I was working with another project team, a very experienced team having much bigger resource pool. Team was enhancing and managing an accounting product. Product was having some issues in core implementation, due to which we were getting lot of bugs around the years. Course of action was to patch the data or correct the current broken flow of application by temporary fixes. Team was spending many hours in this exercise. Although team had great skills and experience, however, nobody was willing to fix the core issue. Reason, that would need complete rewrite of that component; a critical piece of the product. And it was comparatively easy and less risky to make fixes. Hence, due to lack of right attitude and driving force, we kept on putting hours of efforts in fixing the bugs only.

By now, we already know the difference between first and second example. It is not (only) about skills and experience, but, it is more about right attitude. In second example, team was much experienced and bigger. Many of the members were skilled enough to do right things and do the things right. However, differentiating factor was the right 'attitude'. It needs a high level of 'can do' and risk taking attitude to say, "Let’s build something better even if it mean scrapping existing piece of code. Let’s write a good product, where team can spend time adding value to the product instead of fixing issues and doing plumbing work around the year. Let sit and figure out, how we can improve the things".

Finding skills and experience could be easy, however, finding and developing right attitude needs a lot of efforts. Also it does not end with the attitude of individuals, rather attitude of leaders also play a big role in developing this whole eco-system. In first example, it was the leader who has given weightage to the right attitude over skills, education and experience. It was the leader who has promoted the attitude to take the risk and to challenge the stagnant beliefs to improve the product.

When right attitude is mixed with right set of environment, people take action. They become passionate for the goals, for the things which they are doing. They go extra mile to build what they believe in. A very important element in producing great products is the attitude of people working on it.

It takes whole village to build a good product and a successful Organization, however, it takes a right set of attitude of team and the leader to build and groom that village.

What is your experience for role of 'attitude' in building great products, what are your examples?

Thank You Mentors

When I started moving in professional career, I came to know about term 'Mentor'. Wondering what it is, I found that many of the people were talking about being mentored by various great personalities. And it is said to be a great opportunity to learn and grow. I was not even aware about it, hence I started feeling insecure and kind of left out. Am I not worthy enough or I am not looking for one. Why I haven't found one so far..

However, eventually I found that it is not always the single person who comes in formally, wearing a hat of 'Mentor' and bestow her blessings. Rather, it could be more than one people who keep sharing their wisdom and experience informally with us, either intentionally taking interests in us or casually just sharing few hints from their wisdom and life experiences.

At the age of 19, when I joined my first job to manage a mechanical workshop of 20 people, I found it very difficult to deal with people who are much older and experienced than me. Then my senior 'Dinesh Sharma' hold my hand and said, "You have to be bold and confident to deal with them. Also, Understanding their context, Respecting everybody and Integrity in yours 'words and action' is an important ingredient to manage the talent". And that lecture worked for me.

My few first days as Software Engineer, I was completely lost in a whole new world. People around me were using terminologies which were unknown to me. I was feeling like I don't know anything, especially when anybody comes to you and said, "Hey, you are working on this since morning.. that is 2 hour job if you use xxxxx". I got a supportive voice from Vikas Joshi who came and sat next to me, saying, "Let us see how we can solve this problem your way". He made me aware about new terminologies, and at the same time assured me that there is not only one, but multiple ways to define and solve any problem. A specific terminology can be good to communicate, but is not the core of solution. He encouraged me to keep learning and keep working steadily and sincerely.

There are even more. My mother who keeps sharing her priceless hard earned experience of life with me, who keeps on mentoring me since childhood and taught to face the life 'seeing in eyes of challenges'. Many of my friends, who shared one or other important lesson with me at every foot step. Many of the great writers, who have shared their valuable experiences in form of great books. One taxi driver, who met me one morning and shared important lesson of life saying, "Life gives us hints about next path. It is we, who want to stick with existing roots or beliefs. Best is to recognize the hints of nature, accept it and move on". There are many more ranging from my childhood teachers to my office cleaner who shared few dews of wisdom from their life experiences unknowingly and unconditionally.

So I feel confident now that I got so many mentors in life which shaped my thought process, the way I am. And what more, life gives us what we wish for, when we need it. Recently I got Ramesh Dharma as my first formal mentor. Since last one year, he is listening to me with all good patience and sharing his fine tuned experience with me. I don't know when I crossed the formal lines and even started reflecting my emotional side also. But he is managing every aspect maturely and is sharing his best of life experience to shape a new path for my journey.

Thanks to all of my great mentors for shaping my life, my journey..

#ThankYouMentor

Inclusive Leadership - An Effective Leadership

On a Friday evening, I was working late in office. I was struggling to fix an issue. That was a complex issue, and I was not finding any solution even after spending many hours on it. I thought to take a break, and decided to work on it after having dinner. I was about to go, when my manager walk over to me, and
He asked: 'Hey mohit, how is it going'.
I said: 'Not that good. We are not reaching anywhere. This issue would take time'.
He said: okkk. But, this is very critical issue and you are not leaving today without fixing it.
Bang.. ! Those words didn't sound good. I thought in my mind 'I can't leave, I am not free to leave..'. I felt bad.
I closed my laptop and told my manager, 'It is 9 pm already. I am tired now. I can't work more today. CU tomorrow..' After saying that, I left the office (sadily)
I reached home. I was very sad. I thought, I could have reacted differently. I was feeling bad, as I never behaved like that with my manager earlier.. I was tensed. I believe my manager would have also felt bad.
Overall, it was an unpleasant experience for both..

.............................
Moving to another incidence..

Few months later, in another project, we had similar kind of scenario. Whole team was packing the bags to leave from office on a Friday evening. Our manager came to our area
and said, 'Hey guys, I have a situation here to discuss and I need your help'.
'Help', that word sounds good to ears. As a normal reaction, we asked, 'ok, tell us please'.
He said 'One of the critical functionality is having issue and client is incurring loss due to this. We need to fix it asap'.
As soon as he said this, we understood that we need to stay back. Our mind started thinking of our plans for evening, like movie, outing etc. However, then our manager add more to his previous sentence.
He said 'I know it is already late and you might have some plans already, however, this issue is important and we have to find a solution as a team for this situation. Still if anyone has any commitment which is more important, do let me know. We can discuss and manage that'.

Everyone in team accepted to stay back. Even few of us came forward with different innovative ideas to fix the issue. Bonus point was, manager stayed whole night with us.. cracking jokes, arranging food for us and so on. We stayed there for 30 hours appx and left next day after fixing the issue. We were tired but were not sad. Rather, we enjoyed with each other, and took all the ownership to get the work done.

What was the difference between these two incidents.

In both stories, manager's intention was to get the work done; which was critical for project or organization. There was nothing wrong in that. However, there was a difference..

In first case, manager had made the decision and tried to force that to team. He had not shown the emotional consideration towards the feelings of his team.
In second incident, if you noticed, 'We' word was used more than 'I' or 'you'. Manager explained the situation along with its impact. He tried to involve everyone in the decision and pulled them on a common platform to take a collective call. Moreover, he conveyed it effectively that he understood 'what team is sacrificing i.e. their personal time' and he openly acknolwedged that.

In both the situations, managers were clear that they need team to stay back and work late to control the situation. But how they conveyed the message, that had made a big difference.

The way we communicate, and involve others in decision making has a big impact. It can make the whole environment tensed or can make people work even for 30 hours happily. Supporting your team, making everybody feel involved in decision making and that their opinion is respected, they are valued, is a big trait of successful people managers. When employees feel included at work, they become better team players and more likely to go above and beyond expectations, suggesting new ideas of getting work done. This, for sure, boost overall organizational performance also.

And this is not only applicable in office, but also in our personal life, in day to day dealings.

Good thing is, we have the options to choose. We can choose either first experience or can go for second leadership style. Choose the best..

Design Considerations for Audit Trail Implementation

Auditing the operations in any application is a very common requirement for security and auditing purpose. Auditing can be done at various levels with varying level of details. Overall prime requirements for Audit Trail are:
  • Collect enough information to determine, 
    • Who has done the changes, 
    • What are the changes, 
    • When these changes have been done, Locale etc
    • What user scenario was in action, i.e. the operation context
  • To capture all user actions, even if some of these are not reaching to DB or would be interacting with external services directly (rare, but happens in some cases)
  • Successful and unsuccessful logons or other security related operations
  • Management of collected audit data, which could be very large. 
  • Search operations on collected data
  • Display the collected data to Users in presentable format as and when demanded 

Considering above requirements, there are various design approaches to implement the audit trail in system. Few of these are given below (considering a JEE application, however, many of these are generic)

  1. Implement DB triggers to capture any change in data states and log in audit tables
  2. Log audit data in business services, which means collecting the required data in each business service operation and log it using some abstract Audit service to some data store
  3. Using generic logging framework like Log4J to log the auditing information to desired format and data store and later parse these logs to extract the required data
  4. Interceptors based approach to intercept all operations, collect the data and log it through Audit service. Here interceptors can be of DAO layer interceptors like Hibernate Interceptors or Service level interceptor using AOP.

All of these approaches have their own pros and cons. As obvious, one approach can not be fit for all. Application state, project requirements and scope can define the right set of implementation. So lets discuss the pros and cons of each of these approaches to understand it more.

Database triggers

Database triggers can do really well and nothing can escape from the triggers. Once these are set carefully on all levels, all changes are bound to pass through these and hence will be captured in audit tables.

Pros:

  • Whether it is simple user operation, or any change is being done by DB admin; all kind of changes will be captured by triggers.
  • A comparatively simple approach, in aspect, that no code change is required and it can be implemented directly at database level without disturbing the code.

How to Stream Media from Window PC to Xbox One


XBox One provides features to stream media from your PC and to enjoy the media on common entertainment box i.e. XBox. Below are simple instructions to setup the streaming of media contents from PC to XBox one, along with solution for one commonly faced problem. Hope it will help.

Note: Instructions are given considering window 7 PC.

On XBox One:

  1. Make sure that Xbox One is connected to your home network, either via wired or wireless connection.
  2. Download the ‘Media Player’ app from Xbox Store. This will help you to explore the media on PC remotely. 
  3. Go to into the “Preferences” option through the user settings menu. Make sure that the “PlayTo” streaming option is checked. 




On PC:

  1. Switch over to your PC. 
  2. Go to Start menu and click on “Devices and Printers”.
  3. Use ‘Add a device’ and add Xbox one as one Device. 
  4. Open Window Media Player
  5. Go to ‘Stream’ menu and enable the ‘Allow Remote Control of my Player’ and ‘Automatically Allow Devices to play my Media’ options. 

Leading by Example - An Interesting Approach to Lead

Albert Einstein once said “Setting an example is not the main means of influencing others, it is the only means.”

To compliment this quote, let me tell you a story. Story begins 16 years back when I started working as shop supervisor in a mechanical workshop. Workshop had around 25 skilled technicians. Most of them were in age group of 30s to 50s. It was a challenging job for a 19 year old boy to manage these experienced and skilled workers. Hence I had various wonderful learnings during this job. Following is one of such interesting learning.

Very first day, when I entered in the workshop, I found it very unclean and untidy. There were some obvious reasons for being dirty. Like being a mechanical workshop, there was lot of scrap production daily. Lot of oil was being used for lubrication along with various coolants also. However, still there were good reasons to believe that it can be comparatively cleaner. I felt a need to change or improve. Being very new to the Organization, I decided to wait for sometime. Eventually I started discussing with team members about cleaning the place. One day I got a simply reply from few workers for not cleaning the workshop, that was, "Either we can clean the workshop or can complete our day job. You tell us what we need to do". Sound familiar :). Even today sometimes I heard similar reasoning that, "Either we can improve the code/process, or can make the delivery". I understood the problem and gave it some more time.

One morning, I thought that I should clean my place at least. My place comprised of one table, chair, cupboard, some documents and lot of dirt. I spent 3-4 hours and cleaned it completely. All the workers were looking at me quite surprisingly. At the end of the day, I was happy that I did what I liked and what I should have done. There was no expectation around. Next morning, 2-3 of the workers came to my seat and told me that they also wanted to clean their place. They asked, can I manage the time break for cleaning. I took the responsibility and told that I shall manage it. They called all other workers and discussed with them. That day, all the them worked as a team and cleaned the workshop for 4-5 hours. Results were obviously pleasant. Workshop was completely changed, air was purified. All of the co-workers were appreciating the change themselves. Earlier they had to find a clean place to have their tea, now whole workshop was cleaned enough to sit anywhere.

Vedic Math - Divsion by 9

Note: Vedic Math Blog has been moved to http://vedicmath.vedantatree.com/. Please bookmark the new address for new and existing blogs.

Let us learn, how to do 'Division' operation using 'Vedic Math'. Conventionally, we do it like following:

Divisor ) Dividend ( Quotient
                ---------
                ---------
             _________
             Remainder

However, in the Vedic process, the format is
Divisor ) Dividend
                --------
           __________________
           Quotient | Remainder

Let us first start with one of the special case of division i.e. Division By 9, a very interesting and simple technique.

When dividing by 9, the remainder is always the digit sum of the original number.

For 2-digit number divided by 9 
To divide ab by 9 : Rewrite ab as a | b . The quotient is a, and the remainder is simply a + b.

    a  |  b
        |  a
    ---------
    a  | a + b

Examples: 

12 divided by 9
Here quotient = 1 and remainder = 1+2 = 3

23 divided by 9
Here quotient = 2 and remainder = 2+3 = 5

70 divided by 9
Here quotient = 7 and remainder = 7+0 = 7

Now, let us discuss the cases when remainder is greater than 9 :-

86 divided by 9
Here quotient = 8 and remainder= 8+6 = 14 ( >9 )
So we add one in the quotient and becomes 9 ; and
remainder becomes 5, after subtracting 9 from 14

New quotient =  9 and New remainder = 5

75 divided by 9
Here quotient = 7 and remainder = 7+5 = 12 ( >9 )
So, New quotient =  8 and New remainder = 3 (12-9=3)

Also, notice here, that the new remainder is just the digit sum of the old remainder.

For 3-digit number divided by 9

      ab  |  c
        a  | a + b
   ---------------
 ab + a | a + b + c

Quotient: ab + a ; Remainder: a + b + c. However, remember that the remainder should be less than 9. And if remainder is greater than 9; we add 1 to quotient and subtract 9 from the remainder.