<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ujjawal Kumar on Medium]]></title>
        <description><![CDATA[Stories by Ujjawal Kumar on Medium]]></description>
        <link>https://medium.com/@kujjawal?source=rss-1bfa79584fd0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6-iBGHmomOgM47PD</url>
            <title>Stories by Ujjawal Kumar on Medium</title>
            <link>https://medium.com/@kujjawal?source=rss-1bfa79584fd0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 20:45:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kujjawal/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Every Developer Should Write Tests]]></title>
            <link>https://kujjawal.medium.com/why-every-developer-should-write-tests-51265159adef?source=rss-1bfa79584fd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/51265159adef</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ujjawal Kumar]]></dc:creator>
            <pubDate>Wed, 04 Dec 2024 22:16:16 GMT</pubDate>
            <atom:updated>2024-12-04T22:16:16.828Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ai1CiaEThbWVMKpwUmpWWg.png" /></figure><p>I have almost 4.5 years of experience in Android development, and writing test cases was something I hated the most. The simple reason that motivated me to start writing test cases is:</p><blockquote><strong>You can’t verify everything every time manually.</strong></blockquote><p>Let’s talk about some common excuses we give to avoid writing test cases:</p><ol><li>I write better code :)</li><li>Testing is the Manual/Automation QA team’s job.</li><li>It’s redundant and time-consuming.</li></ol><p><strong>I write better code:</strong></p><p>Seriously? If your code can’t be unit tested, chances are it’s tightly coupled and violates basic design principles. Writing test cases pushes you to modularize your code, decouple responsibilities, and follow better practices. It ensures that your code is not only functional but also reliable across different scenarios, giving you confidence in its stability.</p><p><strong>Testing is the Manual/Automation QA team’s job:</strong></p><p>Nope, your code is your responsibility. QA teams generally perform black-box testing focusing on app behaviour, they don’t have insights about internal states or values that change based on user actions. While they may cover some scenarios, they can’t catch everything. By writing test cases you handle edge cases, saving both QA’s time and your own during development.</p><p><strong>Redundant &amp; time consuming:</strong></p><p>Writing test cases during development actually saves your time in the long run. It helps you catch bugs early, removing the need for manual testing, and reduces the chances of bugs being reported by QA or PM later. By fixing issues before giving the builds will help you avoid wasting time on repetitive fixes and streamline the development process.</p><p><strong>You can’t verify everything every time manually</strong></p><p>Imagine managing multiple bottom sheets on your home screen:</p><pre>enum class HomeBottomSheetTypes(val priority: Int) {<br>    LOCATION_PERMISSION_BOTTOM_SHEET(priority = 0),<br>    ORDER_RATING_BOTTOM_SHEET(priority = 3),<br>    IN_APP_UPDATE(priority = 2),<br>    PROMOTIONAL_OFFER_BOTTOM_SHEET(priority = 1),<br>    FEATURE_INTRO_BOTTOM_SHEET(priority = 4)<br>}</pre><p>Every time you add a new bottom sheet or tweak the priority of an existing one, you need to test integration of all the other bottom sheets. Doing this manually every time? That’s not just tedious — it’s inefficient and error-prone. Instead, you can <strong>mock the behavior</strong> of each bottom sheet and verify everything with just one click!</p><p>Most of the startups or companies releases a feature build once in a month and improvement or bug fixes build once in a week (or two). Running regression on every build will not only be time consuming but also have chances of human error.</p><p><strong>Let’s make testing a habit. It’s not just about writing code; it’s about writing <em>good</em> code.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51265159adef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smart Caching: Reduce Network Calls and Boost App Performance]]></title>
            <link>https://kujjawal.medium.com/smart-caching-reduce-network-calls-and-boost-app-performance-001bfcb31013?source=rss-1bfa79584fd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/001bfcb31013</guid>
            <category><![CDATA[room]]></category>
            <category><![CDATA[caching]]></category>
            <category><![CDATA[data-versioning]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ujjawal Kumar]]></dc:creator>
            <pubDate>Sun, 13 Oct 2024 03:14:39 GMT</pubDate>
            <atom:updated>2024-10-13T03:14:39.493Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7xu42Pdb5YBjPaZPDP9IqA.png" /><figcaption>Preview image</figcaption></figure><p>As a best practice, we always try to keep most of our app data on the server to avoid frequent app releases, especially for minor changes like text updates. And most of the time, these data does not get updated for weeks (or even months) yet we still fetch it from the remote server each time. We can use <strong>data versioning</strong> here to reduce unnecessary network calls and optimizes app performance.</p><p><strong>Where can you use Data Versioning?</strong></p><ol><li><strong>Screens with Local and Remote Data Sync: </strong>If you have a screen that initially loads data from a local database and then refreshes it by fetching data from a remote server. (e.g., home page)</li><li><strong>Screens with User Input or Static Data: </strong>For screens where the UI can’t be changed once shown and the data doesn’t frequently update but you have fetch it from remote every time. (e.g., a settings page)</li></ol><p>In both cases you can avoid unnecessary network call, You just need to decide when remote data needs to be fetched.</p><p><strong>Example: </strong><a href="https://play.google.com/store/apps/details?id=com.lmev.rider"><strong>Wayo</strong></a><strong>’s Order Feedback Screen</strong></p><p>At <strong>Wayo</strong>, we implemented data versioning for the order feedback screen. This screen shows different options and headings based on the user’s rating. The screen loads quickly because it skips fetching from the server when the data hasn’t changed</p><figure><img alt="Wayo order feedback screen" src="https://cdn-images-1.medium.com/max/304/1*NljGXeWEUjcNUKr6Qmxtrw.jpeg" /><figcaption>Wayo order feedback screen</figcaption></figure><h3>How to Implement Data Versioning?</h3><p>Data versioning is really simple. Here’s what you need to do:</p><ol><li><strong>Add a Version Field: </strong>Add a version field in your kotlin data model to track the version of your local data.</li><li><strong>Remote Version Config : </strong>Create a version config (json) to store current version of all your data and whenever you make changes to the data, increment its version number. You can get this config in your first api that you call during app launch and save it in SharedPreferences for future checks.</li><li><strong>Implement Version Check: </strong>If you follow MVVM pattern you will just need to change your repository code. Here you will compare the local version with the remote version before making an API call. If the versions match, you can skip fetching new data.</li></ol><p><strong>Example Code:</strong></p><pre>class FeedbackRepository @Inject constructor(<br>    private val api: Api,<br>    private val feedbackDao: FeedbackDao<br>) {<br>    suspend fun getFeedbackOptions(): FeedbackOptions? {<br>        val localData = feedbackDao.getFeedbackOptions()<br>        if (localData?.version != Prefs.remoteVersionConfig?.feedbackVersion) {<br>            val remoteData = api.getFeedbackOptions()<br>            if (remoteData != null) {<br>                remoteData.version = Prefs.remoteVersionConfig?.feedbackVersion.orZero()<br>                feedbackDao.updateAll(remoteData)<br>            }<br>            return remoteData<br>        }<br>        return localData<br>    }<br><br>}</pre><p>By using this approach you can ensure that the app only makes network calls when absolutely necessary, reducing data usage, ui updates and improving load times for the user.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=001bfcb31013" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[No More Missing TODOs in Prod]]></title>
            <link>https://kujjawal.medium.com/no-more-missing-todos-in-prod-897ff5b367ba?source=rss-1bfa79584fd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/897ff5b367ba</guid>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[releases]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ujjawal Kumar]]></dc:creator>
            <pubDate>Tue, 08 Oct 2024 21:14:53 GMT</pubDate>
            <atom:updated>2024-10-08T21:14:53.093Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever accidentally left a TODO in production code? We’ve all been there. When working on a large feature, it’s easy to miss something small.</p><p>Consider this example.</p><pre>fun isNewHomeEnabled(): Boolean {<br>  // return getFeatureFlags().isNewHomeEnabled<br>  return true // TODO: remove this<br>}</pre><p>Using TODO() here would throw a NotImplementedError. Instead, you can add an annotation to your debug folder (if one doesn’t exist, create it).</p><p><strong>Create ReleaseBlocker Annotation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7PbQKDKtarjAjBX5pv-QbA.png" /><figcaption>ReleaseBlocker annotation</figcaption></figure><p>Use the annotation like this.</p><pre>fun isNewHomeEnabled(): Boolean {<br>    // return getFeatureFlags().isNewHomeEnabled<br>    @ReleaseBlocker<br>    return true<br>}</pre><p>Now When you try to build a release or beta version, the build will fail with an <em>“Unresolved reference: ReleaseBlocker”</em> error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s9J0OaR4lts92L3gIHutgA.png" /><figcaption><em>Unresolved reference: ReleaseBlocker when build variant switched to release.</em></figcaption></figure><p>With this setup in place, you can confidently ensure that no unfinished or debug code slips into production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=897ff5b367ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Splash Screen API For New App]]></title>
            <link>https://kujjawal.medium.com/splash-screen-api-for-new-app-1679b21ca2ae?source=rss-1bfa79584fd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1679b21ca2ae</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[splash-screen]]></category>
            <dc:creator><![CDATA[Ujjawal Kumar]]></dc:creator>
            <pubDate>Wed, 27 Mar 2024 11:27:48 GMT</pubDate>
            <atom:updated>2024-05-30T10:25:36.903Z</atom:updated>
            <content:encoded><![CDATA[<p>So it all started when I got this suggestion while creating Splash Screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nGYPK-1mnni8T9EzsqvfSw.png" /></figure><p>Usually this <strong>SplashScreenActivity</strong> is mainly responsible for</p><ul><li>Fetching initial app/ user data (from server or db)</li><li>Deciding which screen to launch ( login or home)</li><li>App branding</li></ul><p><strong>Fetching initial app/ user data (from server or db)</strong></p><p>Its not hard as we think, just need to add <strong>setKeepOnScreenCondition </strong>on splashScreen instance and you can pass logic for how long you want to keep your user on splash screen.</p><pre>private var keepOnScreenState = true<br><br>override fun onCreate(savedInstanceState: Bundle?) {<br>        setUpSplashScreen()<br>        super.onCreate(savedInstanceState)<br>        mockApiCall()<br>}<br><br>private fun setUpSplashScreen() {<br>    val splashScreen = installSplashScreen()<br>    splashScreen.setKeepOnScreenCondition {<br>        keepOnScreenState<br>    }<br>}<br><br>private fun mockApiCall() {<br>      lifecycleScope.launch {<br>            delay(3000) // mocked delay<br>            keepOnScreenState = false<br>        }<br>}</pre><p>There is no magic in this, it is just that whenever android wants to draw its first frame, it checks for the value you’re returning and as soon as it gets false it draws the frame (here starts the activity).</p><p><strong>Deciding which screen to launch</strong></p><p>I had to create a single activity (<strong>MainActivity</strong>) to fix this.<br>my MainActivity installs the new splashScreen and when it finishes I add fragments based on data.</p><pre>if (userData != null) {<br>  addHomeFragment()<br>} else {<br>  addLoginFragment()<br>}</pre><p><strong>App branding</strong></p><p>For App branding I have asked my design team to design our animated app icon based on the guidelines provided in documentation.</p><pre>https://developer.android.com/develop/ui/views/launch/splash-screen#elements</pre><p><strong>Thinks to remember</strong></p><ul><li>You need to set your activity theme to Spalsh theme.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kwSK5uKQElOBr4_12S9ZAQ.png" /></figure><ul><li>Theme.App.Starting should have<strong> postSplashScreenTheme</strong> attribute.</li></ul><pre>&lt;style name=&quot;Theme.App&quot; parent=&quot;android:Theme.Material.Light.NoActionBar&quot;&gt;<br>    &lt;item name=&quot;android:windowBackground&quot;&gt;@color/white&lt;/item&gt;<br>&lt;/style&gt;<br>&lt;style name=&quot;Theme.App.Starting&quot; parent=&quot;Theme.SplashScreen.IconBackground&quot;&gt;<br>    &lt;item name=&quot;android:windowBackground&quot;&gt;@color/purple_500&lt;/item&gt;<br>    &lt;item name=&quot;postSplashScreenTheme&quot;&gt;@style/Theme.App&lt;/item&gt;<br>&lt;/style&gt;</pre><p><strong>To be continued….</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1679b21ca2ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>