How software developer fails in two way

Software developer we are fail

As a software developers, we fail in two ways: we build the thing wrong, or we build the wrong thing. 

– Steve Smith

I was revising my knowledge on DDD(Domain Driven Development Not Developers Developers Developers ) and how I enlighten by few of my work starting from Unit Testing to Test Driven Development to Behaviour Driven Development and incorporate with Domain Driven Development. I think knowledge and know how helped me a lot but still sometime I felt doing too much of learning is not worth until you utilise your talent and find out its application and apply in a real life not for just fun but keep stack and build better software and application and solve some great problems of actual business complexity with great enthusiasm.

How long will it take to build a Personal CV site?

Recently I have set a challenge for myself. How long will it take to build a site from scratch and deploy completely. I thought it would be nice and easy 8 hours task but apparently my estimate was dead on the spot. 

So Let me go through the time line and explain you my estimation :

Task Description Estimated Time in Hours Actual Time in Hours
Story board my CV 1.0 1.0
Build a theme 1.5 1.75
Google Analytics setup 0.5 0.25
Keyword research 0.5 0.25
Get and validate external links 0.5 0.25
Generate Animation and Mobile first Screen 1.00 1.00
Get Feedback 1.00 0.75
Signup recaptcha and configure 0.5 0.5
Deploy on server 1.0 0.75
Release and write article 0.50 1.00

Now what is the proof.

Let me show you my proof.  Just visit the site and give your feedback. Love to hear that. Just feeling Awesome…. and awesomeness…….

Ravi_Lodhiya_CV_Resume_-_2018-01-09_20.59.14

How a simple technique helps you to be more Happy in 2018?

What a wonderful time of the year. It’s New Year and time to post something that matters most to me. I had an amazing year and it flew by just like wind and left nothing but memories,  good, wonderful, amazing memories and Learning. Lots of Learning.

Last year I have achieved quite a few things, what ever I have visualized and this year I am going to do the same. I am going to achieve my life goals by visualizing them and make them happen, I know in the way I will meet people like you who is reading this and wonder about this time,  what is it  that Ravi after. Yes I am not after filthy get rich schemes, bitcoins or anything that make you super rich or anything that sound so great to be true. No… I am after a true happiness and that is within everyone, we just don’t know about it, we all are working hard, smart, dump, drain to death… blah blah blah…. all those things are rubbish and Great at controlling your emotions, I will not do that rather I would share a simple technique of breathing which will make you so happy just in few Minutes.

Ready….

All you need to do is simple breathing Inhale and exhale and try to observe your breath while your eyes closed. I know when you close your eyes first time your mind start wondering and its completely OK, because you now start to know that you have observed your thoughts, mind, breath and emotions. And this observation will leads you to depths of your strength, your purpose and all happiness you are seeking. All you need to do is Inhale and exhale and observe your breath. At one stage you will have that spark and you will start feeling sensation but you are not after that you are the observer of everything that happens to you, surrounding you, within you, without you. A state where you are so claim and peace. You have now reached to the true happiness. 

Few minutes a day will keep you so happy that eventually you became a natural at it. This will cost you nothing. Your detachment is a key and yet you are so affectionate to the self. You are more closure than you think.

I have now share the great secret of happiness and you can share with others. I am not a spiritual healer or anything that advertise after money, If you think this helps you to be happy share to more people and help others.

I am so grateful if I ever help you to make happy for even few moments.

Thank you.

Love and Peace.

RL

Practical Implementation of in-memory Repository Patterns

Recently I have been given a task to demonstrate my key knowledge on OOP and Design Patterns and its practical implementation.

The Task

Create an in memory implementation of IRepository<T>

Hints:The solution should be developed in a Test Driven approach, we expect the code you write to have excellent unit test coverage.Keep the solution simple, we value simple architecture and SOLID principles, but we’re not looking for over engineered design.The code should be self-explanatory, documentation should not be required to understand the code.

I have create a solution for that but prior to that I would like to explain what is repository pattern and explain it in my own words and how I implemented by describing my thoughts.

Repository Pattern: what is it?

Repository pattern is a pattern for data access. This is a common design pattern inside of applications that need to perform data access.

Why do we use the Repository Pattern?

Because most of applications do need to access data from some Data source or perhaps multiple data sources, and for that we need to use data access code throughout Business Logic or Domain Model. It is true that data access code typically is very repetitive and it’s concerned with low-level infrastructure details such as opening SQL connection and managing parameters etc.

This pattern will help us to separate the data access code from business logic and increase the testability of an application without real data in the place. and we can simulate data access in unit tests and have a component that works with in-memory data instead of web service or against any database schema.This allows us to unit test to be very repeatable, very low friction and not much effort to set up and it has quick feedback cycle.

So Let us crack on.

A Repository is going to be a class that you build for your application and it’s going to exist somewhere between the Business Logic and the Data Source of your application. You might have multiple repositories inside of an application. You might have a repository for each type of entity that you need to store.

Here we have been given an opportunity to create a solution for in-memory Generic IRepository Implementation which allows us to Save, Delete, Retrieve all or Find data by Id. Because it is generic in nature it can be easily implemented for any other entities.  Likewise here we are talking very specific implementation for IStoreable which has a Property of IComparable. (You must have knowledge of how IComparable works and implements and further details can be found here

image

So let us get back to our original given problem statement:

Following interfaces has been given and we have to implement the concrete class for them.

The first file is IStoreable.cs as given below:

   1: using System;

   2:  

   3: namespace RamInfosystems.Interview

   4: {

   5:     public interface IStoreable

   6:     {

   7:         IComparable Id { get; set; }

   8:     }

   9:     

  10: }

Now next file is IRepository.cs as given below:

   1: using System;

   2: using System.Collections.Generic;

   3:  

   4: namespace RamInfosystems.Interview

   5: {

   6:     // Please create an in memory implementation of IRepository<T> 

   7:  

   8:     public interface IRepository<T> where T : IStoreable

   9:     {

  10:         IEnumerable<T> All();

  11:         void Delete(IComparable id);

  12:         void Save(T item);

  13:         T FindById(IComparable id);

  14:     }

  15: }

 

And we need to create some test in Unit Test file.

My approach to solve this is by applying Test first. Clearly here the implementation of an interface is generic type and has constraints of type Interface. And this will harness the element which we can compare and test against it. So far nothing unusual.

So when you implement the IRepository Class you also need to implement  IStoreable as well. Which I think first you need to figure it out what need to be achieved.

   1: public class TestStoreable : IStoreable

   2:     {

   3:         public string Name { get; set; }

   4:         public IComparable Id { get; set; }

   5:     }

 

So what we need to do here is Implement the IRepository interface and its 4 of Methods as such All, FindByID, Delete and Save. It was pretty obvious that implementation is a key for the each of operation required to be tested. I have to add a property call Name as string to attach.

I started with unit test and create my first test method named Test_Repository_List_Returns_IEnumberable_CorrectType as follows:

   1: [Test]

   2: public void Test_Repository_List_Returns_IEnumberable_CorrectType()

   3: {

   4:   repository = new Repository<TestStoreable>();

   5:   this.expected = repository.All();

   6:   Assert.IsInstanceOf<IEnumerable<TestStoreable>>(expected);

   7: }

Small explanation about the long name. I intend to do readable code as needed and what  my code does is reflect by its name for example test repository list returns when IEnumberable with correct type.

But I don’t have any implementation of Repository or any implementation of All(). Let’s implement it as below:

   1: using System;

   2: using System.Collections.Generic;

   3: using System.Linq;

   4: using System.Text;

   5:  

   6: namespace RamInfosystems.Interview

   7: {

   8:     public class Repository<T> : IRepository<T> where T : IStoreable

   9:     {

  10:         private List<T> entities;

  11:  

  12:         public Repository()

  13:         {

  14:             entities = new List<T>();

  15:         }

  16:  

  17:         public IEnumerable<T> All()

  18:         {

  19:             return entities;

  20:         }

  21:         ///Not fully implemented. 

  22:       

  23:     }

  24: }

so when we call repository.All() it expected to be IEnumberable of generic type and List<T> is a same of the type.  Trick here is a concrete implementation of IStoreable gives us a opportunity to test all() method’s implementation.

Further on Delete(IComparable id) and Save(T item) implementation also based on the writing test first approach, Arrange, Act and Assert is cycle for TDD and I follow the same.

   1: [Test]

   2: public void Test_Repository_Save_AddNewItem()

   3: {

   4:    repository = new Repository<TestStoreable>();

   5:    newItemToBeSaved = new TestStoreable { Id = 1, Name = "ItemToBeSaved" };

   6:    repository.Save(newItemToBeSaved);

   7:    expected = repository.All();

   8:    Assert.IsTrue(((IEnumerable<TestStoreable>)expected).Contains(newItemToBeSaved));

   9: }

  10:  

  11: [Test]

  12: public void Test_Repository_Delete_An_Existing_Item()

  13: {

  14:    repository = new Repository<TestStoreable>();

  15:    anExistingItem = new TestStoreable { Id = 1, Name = "AnExistingItemToBeDeleted" };

  16:  

  17:    repository.Save(anExistingItem);

  18:    repository.Delete(1);

  19:    expected = repository.All();

  20:  

  21:    Assert.IsFalse(((IEnumerable<TestStoreable>)expected).Contains(anExistingItem));

  22: }

 

Now it is obvious for method Delete we are providing an ID (which is IComparable) and which leads to additional method to create as it requires Predicate of its type and we can fetch through the Id by lambda expression  as follows

   1: private Predicate<T> MatchedId(IComparable id)

   2: {

   3:   return match => match.Id.Equals(id);

   4: }

 

Alright. so it help to find an Id which provided in the Delete method. Also it add an advantage to avoid a duplicate id in the Save operation shown as follows

   1: public void Save(T item)

   2: {

   3:    Delete(item.Id); // Avoid Duplicate

   4:    entities.Add(item);

   5: }

 

Here it might get tricky as Lazy evaluation of Find as we are passing IComparable Id which lead us to do certain things.  

   1: [Test]

   2: public void Test_Repository_Find_By_Id()

   3: {

   4:     repository = new Repository<TestStoreable>();

   5:     someItem = new TestStoreable { Id = 2, Name = "SomeItem" };

   6:     anExistingItem = new TestStoreable { Id = 1, Name = "ExistingItem" };

   7:     newItemToBeSaved = new TestStoreable { Id = 3, Name = "NewItemToBeSaved" };

   8:     repository.Save(someItem);

   9:     repository.Save(anExistingItem);

  10:     repository.Save(newItemToBeSaved);

  11:  

  12:     expected = repository.FindById(2);

  13:  

  14:     Assert.AreEqual(someItem, expected);

  15: }

And finally Implementation of FindById.

   1: public T FindById(IComparable id)

   2: {

   3:     return entities.Find(MatchedId(id));

   4: }

 

This will harness all the uses of Predicates and Generic list to find and match equal ids. This technique will help to enhance in-memory sorting and searching very quickly. However I haven’t included any stress-test to generate let us say 100 Million records and measure performance against the memory load or anything as it was out of scope for me at this stage. But Later I am thinking to write a separate article for it.  

I have tried to implement and develop this task using my ability to provide demonstration about how to implement the Repository Pattern for in-memory. 

Consequences

There are a couple consequences to using the Repository Design Pattern. First, you should have an increased level of abstraction inside your application. This is good because it should mean that you’ll have less duplicated code. It also means that you should have code that’s more maintainable, more flexible, and more testable, however, you do have some additional interfaces, some additional classes, some people who are not familiar with the design pattern might need to look at this and figure out exactly what’s going on before they can catch on. When you have data access logic buried right inside of your business code, sometimes it’s very easy to look at that and understand what’s going on, but it just doesn’t scale up well, and in complex applications, you really need this increased level of abstraction just to manage the complexity. Another consequence of the Repository Design Pattern is that you are one step further away from the data. Since the Repository is shielding you from the underlying infrastructure, sometimes it can also be more difficult to get hints into that infrastructure that can help it optimize some of the operations that it needs to perform against the Data Source.

Summary

Here I tried to explain the Repository Design Pattern and how we can use it to keep Business Logic and Domain Model free of data access code and away from infrastructure code and actual components that talk to the database.

Using the Repository Pattern, I was able to write more maintainable code and easily unit test code. And  I showed a specific example that implemented a generic repository in C# code, the IRepository<T> interface. Using the magic of Generics, I was able to provide a single concrete implementation of this interface that covers most of our needs in an application.

If you are looking for a code or repository you can get it from code project and stack overflow as link given below:

https://www.codeproject.com/Articles/1220983/Practical-Implementation-of-in-memory-Repository-Pattern

Introduction First Video Post

Hi all, my name is Ravi Lodhiya and I am a Full stack developer, this is my first video post. I am looking for a Contract opportunity in the Microsoft Technologies stack. I am available immediately for an interview. Please email me your Job Specification. Thanks for watching. I hope to speak you soon. Bye.

Move On Up

LYRICS

Hush now child, and don’t you cry

Your folks might understand you, by and by

Move on up, toward your destination

You may find from time to time

Complication

Bight your lip, and take a trip

Though there may be wet road ahead

And you cannot slip

So move on up for peace will find

Into the steeple of beautiful people

Where there’s only one kind

So hush now child, and don’t you cry

Your folks might understand you, by and by

Move on up, and keep on wishing

Remember your dream is your only scheme

So keep on pushing

Take nothing less, than the second best

Do not obey, you must keep your say

You can past the test

Just move on up, to a greater day

With just a little faith

If you put your mind to it you can surely do it

Just move on up

Move on up

But move on up

Oh child, but just move on up

But move on up

Move on up

Songwriters: Curtis Mayfield

Move On Up lyrics © Warner/Chappell Music, Inc

Overwhelm by LinkedIn responses

image

Original Post

I am really overwhelm by the response and viewers who looked at my post on LinkedIn. It is but obvious that I can not able to pin point who looked at it but at least I can say 182 of them where Managers/CEOs which means to me a lot. Most of them were Recruiters as you can see. But I am More interested talking to managers/directors where I think I can add value to their organization.

I admire all the companies and their management styles, they all are great and I am proud that some of the most recognised companies from Midlands and I adore them all. For the new role I am really keen to meet personally which allow me to excel my dreams and in return I will give my commitment to the company to put value back by serve them for next 5 years undoubted.

If it sounds good enough to you and feel that investing in my intellectual can reward your organization with greater returns then please contact me or delegate your HR to send me a proposal which I unable to denied. Your HR can email me from here.

I look forward to hear from you soon.

Sincerely,

Ravi Lodhiya

p.s.: If you are a Key Decision maker and want to save 25% agency fees then please approach me directly.

p.p.s.: Recruiters don’t be afraid to contact me either. I admire you equally and happy to have you business. So feel free to drop me a line.

Simple can be harder than complex

Simple Can be harder than complex

Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it’s worth it in the end because once you get there, you can move mountains.

-Steve Jobs

Motivation make my day.

How to convert legacy site to responsive site without breaking it ?

I have been asked many time for how do you convert legacy site to responsive site. There is no easy answer to that, however over the years I have gained experience about how to do it wisely.

First of all, we need to understand what is responsive and what do we expect to see or not see when render to the different screens or estates. In other words, what do you want to hide and what do you want to show. Visualize it and walk through it by paper prototype and not even that if possible just build quick prototype (abstract functionality) for understand behaviour and set for the feedback from actual users and refine it until wow factor seen.

Upon agreement then I look at all the elements on the page and we tried to bind regions and match existing functionality to the each regions. It is harder than the said but we have to do it that way only to avoid error or even better failures.  Each region is like a view or possible view and without modifying its core functionality, I estimate it to bolt on new design by middle layer.

the_Rabbit_Hole

So how long do you think it would take?

Great question. It depends on how deep the rabbit hole goes. How tightly couple your design is and how well you can abstract those dependencies. All that counts. But for sure you need to be consistent with its development, and depend on complexity and usability. When I say how long, my understanding is when user able to use it live. It is tough to understand but it has to be like that way.

So if you think I have calibre to help you in your ongoing project or project that needs facelift and delivered without loosing its core. Ask me or just contact me and book appointment to discuss over a nice cup of tea. I will be delighted.