Learn once, apply everywhere and the SJGAR stack

v0.3 - last updated February 2022

Introduction

As a software engineer there is one constant factor that never changes: You are always learning something new. You invest time in gaining knowledge in order to apply that knowledge to build useful software for your customer or business.
Learn once, apply every is about learning something and applying the gained knowledge in one context, and then being able to apply it in another.
The mantra was made popular by React Native and in that community is now widely known as 'Learn once, write everywhere'.
Note that this is in contrast to the 'write once, run everywhere' approach which is about creating products running on different platforms with the same code. This approach works to a certain extent. The most successful example being the web, where you can create applications that run in browsers on many different platforms. From desktop to mobile, for MacOS and Windows, and for iOS and Android. However reusing code on servers and clients or new form factors like Apple Watch usually require their own special code.

Examples of Learn once, apply everywhere with the SJGAR stack

  • Unit testing with Jest
    Learn once: You learned unit testing with Jest while creating iOS and Android apps with React Native and JavaScript.
    Apply everywhere: You can apply the knowledge you gained on using Jest on the web with React and on the server with Node.js.
  • Server Client Communication with Apollo Client
    Learn once: You learned how to exchange data between server and the client when creating a Web app with React by using Apollo Client. You also learned how to deal with advanced topics like caching and optimistic UI.
    Apply everywhere: Apollo Client integrates with React Native in exactly the same way as it does on Web. Your knowledge transfers easily to creating native mobile apps for iOS and Android.
  • Structuring Apps and State Management with React and React Native
    Learn once: You learned how to structure your app and handle stage in medium to complex web applications with React hooks, state and context.
    Apply everywhere: Apply this same knowledge in mobile apps with React Native.
  • General Programming Knowledge with JavaScript or TypeScript
    Learn once: You learned how to perform general programming tasks like transforming pieces of data or handling async tasks like calling APIs on the web.
    Apply everywhere: This code literally can run not only on the web, but also on native mobile and on the server. Copy/paste the code from client to server or extract into shared libraries.

Further reading