Redux and React-Native

The concept of Redux is similar to the concept of  sessions in .Net world. Redux is a framework used to effectively manage the temporary information called State which can be used through the application. Examples of such temporary information could be data retrieved from database that needs to stored temporarily in a global object, in this case State, that can be accessed throughout the application.

Redux is a framework on its own and has nothing to do with react-native. In order for react-native to use Redux framework, react redux package needs to be installed inside the react native project using the below command line.

npm install –save redux react-redux

react-redux framework uses provider to connect react components with Redux. Provider establishes the communication between React-Native framework and Redux by using connect() which connects the components to the State of the application.

Redux manages the state using three important features: Stores, actions and reducers. Actions as the name implies is the functionality that needs to be executed like for e.g., saving a to-do list in the state. Actions are fed to the reducer which changes the state like for e.g., the logic to save the to-do list lies in the reducer. However, both actions and reducers are useless by themselves without Store. Store is the object that coordinates the communication between action and reducers by dispatching action to the reducer.

When the application starts all the reducers are ran and the corresponding objects inside the reducer are populated to produce the state. Since the state objects are pre-populated, any component can access the State using the function connect() in the Provider framework. These states can be later modified as necessary by dispatching an action. Note that there can be multiple reducers for an application to hold different forms of data like for e.g., to hold the name of persons and another to hold the details of each person etc..

Productivity tool 1.2

Though Thoughts tracker has helped me stay focused on the tasks at hand, I still realized that my progress on the App development has been slow. So I took some time to learn from what every other successful programmer has been doing and that’s when I stumbled upon this amazing book by John Sonmez – Soft Skills: The Software Developer’s Life Manual.

Here are the key takeaways to improve your efficiency:

  • You don’t necessarily need to have an exact end goal in mind but you should definitely need to know the approximate end goal – your life purpose – so you can steer your career in that direction.
  • Break down your end goal to a clear short term goal.
  • Now that you know what exactly you want and in order for you to get there faster, you have to be efficient in how to learn faster.
    • Define your goal – what you would like to achieve with the programming language.
    • Do some leg work on all the resources available and pick only the best.
    • Skim through these resources to get a high level overview of the programming language and immediately start playing around with the code.
    • Now that you have  a lot of questions, go back to the resources and only learn 20% of the programming language in detail to achieve your desired goal.
    • Once you learn the 20%, teach the 20% that you learned by writing blogs or teaching students or making presentations at code camps, Tech meetups or posting videos on YouTube.
    • If you are still struggling, it might be due to the lack of understanding of some basics. If this is the case, go back and learn your basics so you will save a lot of time later on.

Out of all these points, teaching is what resonates with me the best. If I had to learn from my past, the only reason I landed a job at eBay is because of teaching SQL Server course to other DBAs which made me an expert in that area. Similarly not using the words I learned still makes me struggle with Vocabulary. From now on as soon as I learn a word, I will find a way to use it in a story and share it on YouTube.

 

Productivity tool 1.1

I often find it hard to focus on the tasks at hand. I instead catch myself Facebooking, YouTubing, day dreaming sitting in front of the computer when I should be getting some work done. I also tend to forget the commitments I have made and miss the deadlines which makes me appear so disorganized, confused and unprofessional. To remedy the situation, I installed paid software to block the Social Media websites, read thousands of books on Time Management, heard so many people preach on the subject, sought for help but none of the solutions they offered worked. So I came up with my own tool – Thoughts Tracker.

Thoughts tracker is nothing more than a spreadsheet to record all your thoughts crossing your mind. It is based on the principle that if you are fully aware of what you are thinking, you will decide what thoughts to keep and what to ignore thereby redirecting your actions towards thoughts that matter the most.

Thoughts tracker has two basic sections – Action items and Thoughts. Thoughts is further classified into Sub conscious thoughts and Distracting thoughts.

The section “Thoughts” is the core aspect of this tool and helps you become fully aware of your thoughts. When I lose focus working on an action item, I immediately start observing where my thoughts are wandering. I pay attention to them and categorize the thought as either Sub Conscious or Distracting.

Action Items:

  • Complete your algorithmic assignment by 01/12/2017
  • Work for 2 hours on the blog on 01/12/2017.
Sub Conscious Thoughts:

  • Check if Rohit is coming
  • Get the VPN doc
  • Test my GoPro in water
Distracting Thoughts:

  • Got distracted by facebook after my desire to check the post I published for mentors on 01/13/2017
  • I couldn’t help but check out prices of flights to Bali
  • I got distracted about a past conversation on  a football game.

I would start by writing a list of action items I would like to accomplish and as I am working on the action item, if I happen to notice that I got distracted by Facebook, I will immediately write down the date and the time I opened the Facebook website. The more number of times I get distracted, the more number of entries I would notice on the sheet. This would make me become self aware about the time I am losing. The manager inside me is watching so I have to get back on track instead of indefinitely getting lost in the world of Social Media. There are also times when I would get lost in thinking about a useless discussion I had with my friend on the topic of Aliens which I would categorize as Distracting thought.

However, most of the times I would get distracted by a useful thought. The useful thought could be thinking about a friend whom I haven’t called in for a long time or my desire to travel to Bali or go rock climbing and sometimes it could be an argument I had with my wife. These thoughts help me know myself better and the fact that I have written them down prevents me from further sitting on those thoughts indefinitely. I note them under Sub Conscious thoughts and move on with my current action item. 

It is also important that we don’t attach ourselves to the thoughts instead just observe them. When you happen to attach yourself to the thought mainly self defeating thoughts, you will not be able to focus on the task at hand. For e.g., if you have a self-defeating thought that says you are not smart enough, don’t treat the thought as a reality and attach yourself to it. Instead treat the thought as a thought by saying “Aha, that’s a self-defeating thought. I am going to write it down and move on.” If I don’t write down the thought, the sub conscious thought lingers in my head. In such cases, I will neither be able to focus on the task at hand nor will be able to put a closure on the sub conscious thought. The end result is spending countless hours being unproductive.

When I have some downtime, I go through the list of Sub Conscious thoughts and incorporate them into my routine. By going through this list, I have realized that I have a penchant for high intensity sports like rock climbing, volleyball etc… I also realized that I miss my family in India way too much and that for me to feel happy I need to visit them atleast once a year. Using the thoughts tracker helped me realize what I love in life and so incorporated those activities into the “Action Items” section to live a holistic life.

I review the list of Action items every morning. These are the items that I need to take action on. The list of Action items helps me stay focused and organized. Ever since I started maintaining the list of action items, I have eliminated the phrases like, “Oops, I forgot that there is a deadline, Oops I forgot that I need to mail this thing out yesterday”. Instead every day I feel empowered to know that I am focused on the actions which are aligned with my passion based on the thoughts that bring me joy. When you try to do something that doesn’t align with your passion and who you are, you can never make the best use of your time and you can easily figure out what activities to keep and what activities to discard using this tool. 

If you would like to try this out, start with creating a basic list of action items that you would like to accomplish. As you are working on your action item, write down the thoughts in the respective section of Thoughts tracker. Over time, your focus rates will be quadrupled.