The issue behind injecting a dependency resolver

In object oriented programming, it’s important to clearly define the relations between objects. When you’re looking at a given object dependencies, it should be intuitive to understand how the object behaves and what are the other objects it relies on by looking at its public API.

Another reason would be that your object can’t live without the dependency resolver. If you want to reuse your object elsewhere -in an application that uses another dependency resolver component- you’ll then have to rethink the way your object get its dependencies and refactor it.

When a service has many dependencies, injecting a dependency resolver to let the service manage its dependency by its own might be tempting and relevant. But this solution -which introduces the listed above drawbacks- does not address the real problem, which is introduced by your design.

You should first ask yourself the question; Why your object relies on all these dependencies.

In object-oriented programming, the single responsibility principle states that every context (class, function, variable, etc.) should define a single responsibility, and that responsibility should be entirely encapsulated by the context. All its services should be narrowly aligned with that responsibility. Source: Wikipedia

This definition clearly prevents designs that provides a highly coupled – non orthogonal – objects. If you want for example to design a user manager that fetch users from your database and manage their roles, your design should consider providing a service per responsibility: A service that fetch users and save them to your database and another service that manages the users roles.

The Pragmatic Programmer – My Review

The Pragmatic ProgrammerI started reading The Pragmatic Programmer three weeks ago. It was a gift I received on the occasion of my 28th birthday! And now that I just finished the book, I decided to write this review to share my thoughts on all what grabbed my attention while reading it.

As a long-time programmer and architect, I was always thinking that being pragmatic isn’t only a matter of mastering technologies but also and more importantly a matter of wisdom and maturity. I would define pragmatic programmers as those who developed the ability to keep in mind the big picture of a given project when diving into every aspect of it. This paradigm isn’t taught at schools and universities.

This book teaches you how to adopt the right mindset when addressing certain classes of problems. It shows pragmatic techniques that help you become a better programmer. Each aspect is illustrated through relevant analogies (as the helicopter example to explain orthogonality) and summarized into a collection of inspiring tips. I selected some of them,

  • Care About Your Craft
  • Provide Options, Don’t Make Lame Excuses
  • Be a Catalyst for Change
  • Design with Contracts
  • Abstractions Live Longer than Details
  • Don’t Assume It—Prove It
  • Organize around functionalities, not job functions
  • Always Design for Concurrency
  • Don’t Think Outside the Box—Find the Box
  • Don’t Live with Broken Windows
  • Remember the Big Picture
  • It’s Both What You Say and the Way You Say It
  • Don’t Be a Slave to Formal Methods
  • Organize Teams Around Functionality
  • … and so on

Andrew and David provide a set of practical advices based on their many years of experience adapting and integrating a large variety of techniques and tools to improve their processes. These advices are addressed to both beginners and experts, even if you just started coding, grab a copy of this book, you may probably don’t understand all the concepts but there will be enough to learn for you.

Also, many explanations in this book are  language-independent, which is really nice.

You’ll probably find many reviews on the web,  but I would like to quote Kent Beck, author of Extreme Programming Explained: Embrace Change, who says:

“The cool thing about this book is that it’s great for keeping the programming process fresh. The book helps you to continue to grow and clearly comes from people who have been there.

I would also refer to John Lakos’s (Author of Large Scale C++ Software Design) point of view,

“The wisdom and practical experience of the authors is obvious. The topics presented are relevant and useful…By far its greatest strength for me has been the outstanding analogies–tracer bullets, broken windows, and the fabulous helicopter-based explanation of the need for orthogonality, especially in a crisis situation. I have little doubt that this book will eventually become an excellent source of useful information for journeymen programmers and expert mentors alike.”

If I had to summarize my impressions after reading this book, I would join Kent & Lakos on their thoughts.

I decided then to run, everywhere I go.

run_resized

Myrtle Edwards Park to Downtown – Seattle, WA

It all started in october 2011, when I decided to register for an 8 Mile run. I remember that day as if it was yesterday. I was both eager and afraid about the idea of running without any specific preparation. Not that I was too confident about the race, but I was too busy focusing on my professional work, that I couldn’t find enough time to train well for this race.

It didn’t go the way I expected; I remember I started struggling at about 5 miles and after running through pain for about 3 miles, I felt down when crossing the finish line. I wasn’t happy with the way I ran that race (especially the last few miles), but It was a challenge I wanted to complete so I felt a little satisfaction all the same.

How I became addicted to running …

Since this first experience, and because I now run more frequently, I have discovered the pleasure of running. And because I have been running at regular intervals for a while, I’ve noticed some changes in my everyday life. Other than the physical and mental benefits that everybody is aware of. It boosts my productivity at work and it made me feel better all the time.

I was so used to running that even when I was sick and lying in bed, my body continued to crave a run. I also consider running as a great stress-reliever: It helps you feel energetic all the time and It’s also an efficient way to drop pounds (I lost about 26 pounds since I started running).

Like many runners, I’ve also experienced reaching the “runner’s hight“, feeling euphoric after a long run when your body starts releasing endorphins; those feel-good hormones that help you feel good, comfortable and relaxed.

Challenging myself …

There’s nothing more empowering than setting a personal goal and achieving it. This rule also apply to running; when I started running, my main motivation was to lose weight. And, after many months of practicing, I decided to push my limits by improving my personal records on time and distance. I used to track my progress using RunKeeper, Endomondo and Strava which are all great tools to manage running activities and to help you achieve goals.

As I was always running the same route over and over again, getting motivated for a run became much harder. It was time to look for new challenges as running became a part of my lifestyle. And because I was traveling a lot between Europe, North Africa and America, I developed the idea of running in every city I went to; experiencing new routes and meeting other runners all around the globe. I was so excited about this new challenge that I started looking for the best running paths that fit my schedule during my last trip to the USA.

How did it go?

Now that I’m back in France after a three week stay in America where I ran in NY, Miami, Portland and Seattle I’m more excited about this new chanllenge than ever before. I was always so excited about trying new routes and I met many passionate runners in Central Park. It was so cool running along Miami Beach, and even if it was raining all day in Portland, I enjoyed running along the Waterfront park from where the view was so inspiring.

Seattle was my last running stop (Picture above). I moved then to San Francisco where I had a health problem (nothing related to my running activities) which prevented me from completing a last run before flying back to Paris.

And now that I’m back home and recovering, I’m waiting for my personal doctor to allow me running a 7 Mile race which is better known as the “10km l’Équipe” and which will take place here in Paris next week.

What’s next?

As it seems that my running activities fit well with my travel plans, I will probably be running Algiers next August,  Rouen in october and Berlin in February.

If you’re a passionate runner like me, feel free to share your experience and to follow me on Runkeeper, Endomondo and Strava.

I got my Nexus 10 :)

I unboxed my Nexus 10 two weeks ago, and I’ve been using it for the last fifteen days. So, I’ve decided to write this blog post to share my first impressions,

First, the resolution is great!

I was trying few days before the sibling Nexus 7 to see the difference between the 7-inch and the 10-inch tablet and I still was hesitating.
One of the main reasons I chose the Nexus 10 is its resolution. As soon as I turned it on for the first time, I was impressed by its mind-blowing 2560×1600 resolution! When I started surfing the web and checking my next reading to see how sharp the display was, clarity was then my first satisfaction. Thanks to the 300 ppi pixels density which made the display so sharp.

Good for watching videos!

As a passionate web and mobile developer, I’m used to watching videos of conferences, meetups and large-scale tech events held elsewhere in the world where I can’t be :-/

And now, I have a good video experience using this tablet. Putting Speakers on both sides of the device seems to be a great idea! The sound is also pretty good; there’s no distortions.

Google also said that it’s going to be powerful with its Dual-core A15 of CPU and Quad-core Mali T604 of GPU and I noticed that it truly is. I’m not a gamer but I tried a Rockstar game called Grand theft Auto. It was loading very fast, but I would have preferred it to be as smooth as the Nexus 4 I tried three days before. The Nexus 4 provides a much better gaming experience, but let’s say the Nexus 10 is also great for gaming.

Hangouts and video conferences.

I really appreciated the 1.9 MP front facing camera which I used a lot for hangouts and video conferences. There’s also a camera on the back with LED flash. But I’m not the kind of guy who takes pictures using a 10-inch tablet 😀  So, I won’t be using it much. I prefer my smartphone, which is more appropriate and easier to use for photo-taking.

What could be improved?

Even if my initial impression was good, I noticed a bit of slow down when there are multiple tasks running. This could be improved.
Comparing to the iPad, even if the Android ecosystem is providing multiple applications, It’s not at the same quality level. However, we’ll certainly get more stability and quality in the next few months. The first version of the iPad faced the same problem. It’s more about time and maturity.

Some more things …

  • The Nexus 10 also offers an interesting battery life for a so high resolution display, I consider 3 days of normal use as being a good performance for the quality it provides.
  • The Jelly Bean 4.2 with its multi-user support allows you to personalize everything.
  • Ice Cream Sandwich and previous versions of Jelly Bean users should be familiar with the display.
  • I was not familiar with the notifications and connectivity features on the top right and left of the screen, but I liked them.
  • And finally, what you pay for is really what you get!

Final thoughts,

This blog post shouldn’t be considered as a detailed review or a technical analysis of the Google Nexus 10 tablet. A lot of interesting and smart guys have shared much more detailed reviews. People who are still hesitating about their next tablet and those who want to know more about the Nexus 10 should check “Google Nexus 10 Review” by MobileTechReview.