Skip to main content

Similarities & Differences - Learn new Programming Language

    Our mind works in mysterious ways. We learn things by finding similarities and differences. We correlate things by finding if we have something similar learnt in the past. If we are able to find some similarity then great otherwise we start searching for differences. How something is different than what we already know ? Order may not be the same but in both cases our mind is trying to compare and learn. How can we leverage this quality for learning a new programming language ? For instance you remember red and yellow colour by differentiating between them by their visual effect on our eye but you can group them together by their similarity that they both represent colours. In nutshell you create more generalisation or abstraction by using similarities but specialisation is through differentiation. 

    Programming languages are abundant but you know the fact that creating something completely new is very rare when you have some learnings in your brain. Hence we still find few similarities between Programming languages with some differences which makes them unique. I started my career with Java programming and gradually I learnt JVM and non-JVM based languages. Just like any other language there are some basic building blocks of Programming languages too. Human languages follow some grammar, syntax, script and pronunciation ( sound ) similarly Programming languages have the basic build blocks of Data Storage ( Variables ), Functions & Methods ( that work on data ), etc. 

    Historically it is proven that we are adding more layers of abstraction to simplify things. The abstractions also leads to similarities. For example, if learnt to drive a hatchback car then you already know certain basic aspects of driving. One fine day you decided to purchase a new SUV car then you may not know everything about it but to build your confidence you can start with things which you already know. Once you get hold of that then you know the fact that SUVs are ideally suitable for outskirts or unpredictable terrain but hatchbacks have certain limitations with ground clearance, etc. which makes them ideal candidate for city drive.

    Hence I would recommend start by understanding the similar building blocks when you start learning a new programming language. I know Java then I generally start by understanding if there is a way to create a composable thing like class in the new language that I am learning. Certain languages may not have direct equivalent of class but then have to have some way to compose things at certain level for better management of the code. The common aspect here is what is the minimum possible basic composable building block of the programming language. Once we get to know that we can then start with data storage possibilities. Data could be stored in various forms and references can tell us what kind of data is stored. Till date I observed we are managing common data types - Numbers, Strings, Date and Time, Boolean. You may find a tiny difference in different languages but these are what we generally deal with day-in-day-out. All programs have to have some main execution start point. In other words all houses have to have at-least one door to enter in. A java program can have Main class containing main method, scripting languages can have some main script file which you can say is the start point of your execution, etc. The ways to execute or denote something as main entry point can be different but we need to have some concept around the same in the Programming language.

    Summing up I would say that these are the best practices you can follow to learn something new as its more natural way in general to learn anything. Our brain does not remember and recollect something we don't understand and understanding something needs key aspects of grouping and differentiating them based on our prior knowledge. Just a thought ! Keep thinking :)

Comments

Popular posts from this blog

How to install Google font on MacOS

Introduction Google fonts are open source. I was reading through the new angular website  and was astonished by the beautiful font used in the code editor shown in the samples. The font name is DM Mono . I wanted to use the same font on my Visual studio code editor for the Angular project development but I could not find a good blog which will guide through the installation process. Hence I am documenting this blog for the same. Get the font Follow below steps to download a font from Google fonts website . Visit the Google fonts website .  Search for the font you like for example DM Mono Click on the Get font button It will download a zip containing ttf format files Install the font on MacOS Once the zip is downloaded in the default downloads folder on your Mac. Follow below steps Double click to uzip the zip Open the folder Ex: DM_Mono Select all files with extension as .ttf and do not select other files like txt or some other format Keeping all the files selected double clic...

Secure login to MySQL for bash scripts

Introduction In this blog we will connect to a mysql via CLI from a bash script for generating a db dump. A cleaner approach for the same is using mysql config editor. In this blog we are taking an example of a mysql container running inside docker and we have a script for taking a db backup using  mysqldump . We will not use a password as a parameter to  mysqldump  command instead we will use something called as login path. MySQL config editor It is a utility to store authentication credentials in a obfuscated login path file named as  .mylogin.cnf . How to do it ? View existing configurations To view existing configurations if there are any use below command. The command will output existing configurations if there are otherwise it won't print anything. mysql_config_editor print --all Sample output In the output below you can see that the password is obfuscated and is not readable directly. It is handled by the mysql utilities to use this password as per the flags ...

Ruby on rails with Nexus

Introduction In this blog we will use nexus setup for NPM for a project which uses Ruby on rails. In this ruby on rails project we are using YARN and BUN  framework. We did setup a nexus NPM proxy and private repo but yarn could not fetch the npm dependencies via the nexus proxy. The rails assets precompile task however uses bun which uses npm. YARN is a wrapper on the NPM hence it does not entirely rely on NPM. BUN is a runtime which performs all the NPM tasks. Our goal in this blog is to understand how to handle this scenario in a ruby on rails project when use NEXUS NPM proxy. Technical specifications We have below versions of the tools NEXUS : 3.37.1-01 NPM : 9.5.0 NODE : v18.15.0 NVM : 0.39.1 ( Node version manager ) Mac OS : Sonoma 14.2 YARN : 3.5.1 BUN : 1.0.0 Steps Below are the steps required Configure NPM proxy in NEXUS Configure NPM private hosted repo Configure NPM group in NEXUS Change local NPM config for registry Change the YARN config for registry Configure BUN co...