Search This Blog

October 21, 2020

Book Review: Red Yellow Green: What Color is Your Money?

What color is your money? by Noah Gift @ Lean Pub

The book titled, "Red Yellow Green: What Color is Your Money? The survival manual for gig workers and consultants" by Noah Gift is a good and engaging read. I personally have experienced and was diligent enough to escape many a potential predators. Actually, I have come across those predators that are super sweet in talk, popular (don't know if this is a paid for PR thing that is so common these days) for his other works than what he is doing (for example if he is a founder of a tech consulting company, he would have been popular in authoring a book or two), etc. Consulting is definitely a high-risk, high-reward endeavor. It is the same with doing a co-founding venture in a start-up. I would say this is THE MOST  IMPORTANT thing to watch out for during the course of your engagement. The author is in fact polite but firm in pointing this one out, which is my favorite of all. I wish the author cites an example or two of the things on how one could be deceived, to make it more sticky in the minds of a reader. I do think that the author needs to add more content on the later chapters in similar lines with some examples to make it more motivating and interesting.

All said, I would recommend you give this one a read, for it is worth your time and who know might save you from the possible predator. This can be unnerving and very frustrating experience.

Lastly, this review is based on the rough-cuts of this work-in-progress book that was made available in O'Reilly's SafariBooksOnline.

October 11, 2020

My Experience With Expo For React Native



Note: I'm assuming Managed Workflow with Expo to leverage the max out of their services.


Expo : The Good

+ Great for boot-strapping react-native development for cross-platform mobile app development.

+ Possibly a good choice for PoCs to quickly showcase a concept.

+ We get to see the console logs of app in Expo's browser or terminal. This one is a big plus!

+ The documentation is good but could be better.

+ Expo's snack is the code playground in the web browser that will come handy when you want to try out its components from the web-browser and see how it appears in android/ios/browser, before you use it in your project. 

+ Leverage Expo platform for sharing the app in development to Business to get their feedback and adopt accordingly. Agile isn't it?


Expo : The Bad

- Limited choice of reusable React Components that has dependency on native components. Expo is getting better by the day in this, though!

- Their free build service is time consuming (you number in waiting queue could be over 20 with waiting time of over 20 minutes) and paid ones are way too pricey.

- Not all iOS and Android APIs are supported. That said, a great chunk of most used APIs are supported, except for things like Bluetooth, or WebRTC if that matters to you.

- No support for background audio with OS playback controls.

- Doesn't have FastImage incorporated into it and guess is working on its own version of FastImage, calling it expo-image. For the uninitiated, FastImage is to ReactNative, what Glide is to Android and SDWebImage is to iOS; it is a performant image loading and cacheing library.


Expo : The Ugly

- The app size is no less than 60 MB by default. You can reduce about 20 MB by using a property like `enableDangerousExperimentalLeanBuilds: true` in `app.json` for android; but that still keeps the app over 40 MB, which is ridiculous in my opinion. So where your app could do away with just 4 MB in plain Android development, using Expo is an epic failure.

- Expo by default adds way too many unwanted and unwarranted permissions as requirement to the app being published. For instance, it by defaults adds requirement for camera permission. In days of malicious malware being shipped with apps published even in Play-Stores, this will only raise the users' suspicion discouraging them to try the app.

- Connection to Expo dev server gets disconnected after some idle time hampering your hot-reload functionality. When this happens, you will have to reload the app. I experienced this quite often, and it is annoying.


My Verdict

Productivity gained in one thing, is lost in many other things by using Expo. Expo is beginners friendly entry to embracing React Native and may be do a quick PoC. Until things change for better with Expo..

When your Business says, "Tech ain't Rocket Science"


As a Tech-Leader, how do you respond when business smirks and dismisses your challenges in tech saying, "it ain't rocket science"? This post is my attempt of story-telling the complexity in Tech to the ruthless and impatient Business that dismisses it as just being CRUD and is no rocket-science. 

I am a tech-entrepreneur who has made bets on tech, business ideas and its intersection. I have failed for various reasons which is out of scope for this post. Now that introduction is to tell the Business that I understand where their frustration comes from. So I think it is important that they believe in Tech Leadership and its challenges. Not always can this leadership be right. It will go wrong in its bets from time to time. But, hell Business too gets things wrong from time to time, don't you? We should learn to see failure as not the end of a road but only a bend, albeit a hairpin bend at times that if not given due diligence, it can be catastrophic. So what is so crazy about the Tech World that the Rocket Science isn't having? My answer would be EVERYTHING! In Rocket Science the problem space is fairly well defined in that it is mostly science. In the Tech Space, it is oscillates between being an art at one point in time and being science in another circumstances. In Tech Space the choices are umpteen, the shines are mostly mirage and the pitfalls are hardly visible until experienced. Now that is the shortest way in which I could describe the challenges in Tech leadership. 

I can illustrate the tech landscape with my very own little experience in the realm of mobile app development. I had built a couple of Android applications as test of my ideas to understand its market. The Apple iOS ecosystem was a beast on its own and so was Android; each accelerating at a far greater pace in evolution than it is anticipated to be. Additionally the mobile ecosystem in itself had too many variables that you could hardly bet on. 

Take the tangent of, platform for developing mobile mobile applications -- a couple of years back it was native Android/iOS, or cross-platform mobile app development frameworks like Ionic, jQueryMobile, Adobe's PhoneGap, Sencha, Xamarin etc. Today, the very native platforms evolved so much that yesteryears app is just dated to be polite. Add to it Kotlin became popular in the native Android development space, because it is a much better language than Java in terms of maintainability and brevity. The iOS space witnessed Swift replacing Objective C. The community adopted these for good and this was fairly predictable.

But not always is the community adoption a predictable thing. And not always it is wise to go with the crowd, for it might turn out to be a pop-culture thing. This is sort of a high-risk high-rewards sort of thing, in the business parlance. Take the case of community adoption in the cross-platform mobile application development platforms/frameworks. The Facebook's introduction of ReactNative for cross-platform mobile app development became a game changer in this space. Frankly, I didn't bet on it and I was so wrong about it. With the community going ga-ga for it, I had dismissed it as pop-culture; call me a conservative for that and I take it. But wait, this time around, the community made a huge difference by coming up with a ton of open-source tools and components, that I would say had surprised Facebook too. Or Facebook perhaps was anticipating this development from its earlier success with open-sourcing ReactJS. The adoption rate and good produce, prompted Google to come up with Flutter wanting to disrupt this space. While ReactNative (aka RN is based on React.js), Flutter is based on Dart programming language. Taking a stop to reflect back, as things stand today, yesteryear's cross-platform frameworks (like Xamarin, Sencha etc) is just gone from the scene of relevance. Had you invested in those tools years back, you would have had to re-invest in learning the new ways of development in this space. This is tech; the crazy tech, where the craziness of the tech wave comes from the community, which literally can change directions of the wave. You got to ride the wave, float to flaunt, flop but float, fasten and flip, fence from fall, and fall but survive! 

I can share a similar story in the realm of backend development, devops, frontend, etc. but hope this story is more than enough (at least it worked for me in the past) to convince our Business about what it means to ride the Tech wave.

Tech is bloody hard to keep up with. Tell this story of evolution to anyone who is comparing it to Rocket Science. Tell them that Rocket Science don't change as much as tech do. In Rocket Science, you learn that there is so much more to discover in a supposedly closed domain. In Tech, you got to both learn and adopt within the constraints of time, opportunity, challenges and God damned people politics. The bad news is we do fail, and fail often. The good news is we can go past it learning our lessons.

October 10, 2020

Dev Setup of Expo for React Native Development

When you do React Native development using Expo framework there are three ways you can see your development works on your Android device or emulators, depending on how you connect to the Expo development server. 

Note : The one commonality is that you use an Expo-Client on your Android/ios device/emulator to talk to the development server.

Note : The pictures below consider WSL2 on Windows 10 as development environment where Expo server is running. This is purely for representational purpose, and the concepts apply irrespective of your dev env where Expo server is running.

1. Connect using Localhost


  • There is no iOS simulator on Windows. That said, if your dev env is Mac, you could have Expo server running along side ios and Android emulators on the same machine.
  • When you have both the server and the client running on the same host, the best approach to connect them is through localhost.


2. Connect using LAN

  • If you hate emulators/simulators like I do and wish to use the device for development purpose as well, you could well connect the server and the mobile device when they are on the same network. For this make sure you connect your mobile device Wi-Fi to the same network that your laptop is connected to. The is ideal and super fast.
  • When using WSL 2 on Windows, though, I wasn't able to get this set-up working (see my other post on this subject). If you are like me stuck in this, the next option that is available is to make use of Tunneling option.

3. Connect using Tunnel

  • Tunneling is the slowest of the options, because you go through the internet to connect two devices that are literally close to each other.
  • When everything else fails, this is still there for your rescue. Here you leverage the Expo's platform to ship development code to client device for testing using the url that it exposes in the dev-server.
  • This option is also cool when you want to showcase your development work in progress to your clients or other stakeholders as you work through something to get their feedback. Call it Agile, if you wish to ;)


October 9, 2020

Connecting to Expo Dev Server in WSL 2 over LAN

This post drafts things I did to connect my Android device to Expo dev server running in WSL 2 on Windows 10 over LAN connection (in my case using Wi-Fi). The set-up looks like below:


Note: Expo-Client is installed on my android device.

Note: Expo-CLI npm version used is 3.27.14

Assumption: IPv4 address is used over IPv4.

When you run `ip address` in your WSL 2 terminal, you will your ip-address of your VM as something like  172.x.x.x.

When you check the ip address of your Windows 10 host, by running `Get-NetIPConfiguration` in your PowerShell terminal you will find your host ip to be something like 192.168.x.x. When you connect your Android device to the same LAN over Wi-Fi, your ip address would be similar (something like 192.168.x.x).

The fact that WSL 2 isn't sharing the same ip address as its host is an issue to be resolved. This needs to be fixed as first thing, because otherwise how do we even reach the server running in WSL over LAN? The easy fix to this is to prefix your server start command with your windows host ip like `REACT_NATIVE_PACKAGER_HOSTNAME=your_windows_host_ip`. In my case I run the expo server like `REACT_NATIVE_PACKAGER_HOSTNAME=192.168.10.12 expo start`.

Your expo server runs in port ranges of 19000-19006. Make sure your WSL firewall isn't blocking these ports. I have Ubuntu 20.x as my WSL 2 VM. I check to see if my firewall is active and if active are the mentioned ports listed and open by running the command `sudo ufw status verbose`. In my case the firewall status is inactive as expected. Note that using a firewall in WSL is redundant and should you choose to have it activated, you can add those mentioned ports using the command `sudo ufw allow $PORT`, where $PORT is the port number that you want to add to firewall rules to open it up.

You also need to do port forwarding of the mentioned ports on windows host operating system. You can use netsh on your Powershell in admin mode. The cookbook for it will be below commands:
  • List all your portproxy rules: `netsh interface portproxy show v4tov4`.
  • Remove all your portproxy rules: `netsh int portproxy reset all`.
  • Forward Ports into WSL2 :  use the net shell "netsh" to add a portproxy rule. Again, change connectaddress to YOUR WSL2 ipaddress, which is an internal address to your machine.
    netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=19000 connectaddress=127.0.0.1 connectport=19000
  • Open The Firewall: Next, from the same Administrator Windows prompt, open an incoming Firewall Port. You can do it from the Advanced Firewall Settings, but even easier you can use netsh again!
    netsh advfirewall firewall add rule name="Open Port 19000 for WSL2" dir=in action=allow protocol=TCP localport=19000
In an ideal world this should get you going. In my case though, doing all these still didn't help me and I had to resort to tunneling and making use of expo's platform for this.