How To Learn Solidity In 2024
Tags: solidity, ethereum, blockchain, web3
Published: 2024-04-17 01:49:21

*post banner credit: [https://soliditylang.org/](https://soliditylang.org/)*

I suppose you know by now, what [Solidity](https://soliditylang.org/)(the programming language) is all about. 

Just in case you do not, no worries as I'll be explaining that in just a bit. 

For short, Solidity is a programming language that is used for building smart contracts.

> Smart contracts are autonomous computer programs that are executed in a decentralized manner - without the need
of a centralized or third-party entity. They are basically sets of computer codes that control the execution of 
agreements/transactions on top of blockchains. 

To give you a first-hand look of how smart contracts are written in Solidity, just below is some Solidity smart contract code, 
The code below shows how to use variables, structs(a data type), functions and a lot more in Solidity.

As can be easily deduced, the smart contract creates a new user(programmaticPerson), provides for assigning certain data to the 
person(through the person struct), and then also provides for obtaining those individual data (that were added) about the person. 

```solidity
// solidity code

    // SPDX-License-Identifier: MIT

    pragma solidity ^0.8.0;

    contract PracticeContract {
        uint private myNumber;

        struct PersonStruct {
            string name;
            uint favouriteNumber;
            bool isMale;
        }

        PersonStruct private programmaticPerson;

        function setPerson(
            string memory _name,
            uint _favouriteNumber,
            bool _isMale
        ) public {
            programmaticPerson = PersonStruct({
                name: _name,
                favouriteNumber: _favouriteNumber,
                isMale: _isMale
            });
        }

        function getProgrammaticPerson() public view returns (PersonStruct memory) {
            return programmaticPerson;
        } 

        // Function to get the name of the programmatic person
        function getProgrammaticPersonName() public view returns (string memory) {
            return programmaticPerson.name;
        }

        // Function to get the favorite number of the programmatic person
        function getProgrammaticPersonFavouriteNumber() public view returns (uint) {
            return programmaticPerson.favouriteNumber;
        }

        // Function to get the gender of the programmatic person
        function getProgrammaticPersonGender() public view returns (bool) {
            return programmaticPerson.isMale;
        }
    }
```

In this article, I'll be sharing some important details about Solidity, and also giving you some pro-guidance on how best to 
approach learning Solidity - especially if you want to become a blockchain/smart-contract developer in 2024.

**I'll be using the above code-snippet more in this article, so as to help your understanding and drive home the message a 
lot better.** 

## A little more about Solidity.

According to the [Solidity website](https://soliditylang.org/); 

> Solidity is "A statically-typed curly-braces programming language designed for developing smart contracts that run on 
[Ethereum](https://ethereum.org/)"

Even though Solidity can also be used on [Solana](https://solana.com) as explained 
[in this article](https://www.quicknode.com/guides/solana-development/solidity/solang-get-started), Solidity was primarily 
created for programming smart contracts on Ethereum.

Now that you've gotten a good introduction as to what Solidity is all about, Let's move on to explaining how you should approach 
learning solidity in 2024 - expecially if you're intending to become a smart contract developer.

This article is best suited for folks that are totally new to programming - especially those who are just at the beginning 
of their software engineering/development careers - with Solidity as their first programming language. It's also a perfect 
resource for folks who have some programming experience, but have not learnt or used Javascript earlier. 

It's also important to note that the inspiration for this article came through my personal experience. I hope my experience 
helps you discover a better approach that empowers you to learn Solidity in a way that will be more rewarding.  

## How you should approach learning Solidity in 2024.

Below are some key-notes to consider if you wish to Learn Solidity for smart contract development in 2024.

### 1. Learn Javascript first.

The main reason why I recommended this, is the fact that:

- **As a Solidity developer, you will most-likely need Javascript when working with your smart contracts**.

Whether you're a seasoned programmer with experience in working with different programming languages, or just a starter
in the tech space. As long as you intend to become a smart contract developer, learning Javascript is a task you'll hardly 
escape.

A practical example of this, is when working with Hardhat. Hardhat is a javascript-based smart contract development framework
/suite that provides blockchain developers with the necessary stack of tools they need to work with smart contracts. It is
an all-in-one tool for developing, testing, deploying and even interacting with smart contracts.

In the case of using Hardhat, even though your smart contracts are written in Solidity, you will still need Javascript to 
write you test and script like your deployment script(s), or scripts to interract with functionalities provided in 
the smart contact.

Furthermore, when it comes to interracting with your smart contracts(especially in a front-end application) after 
deploying them, you'll still need libraries likely [Ethers js](https://docs.ethers.org/v6/) and 
[Web3 js](https://web3js.readthedocs.io/en/v1.10.0/) or more robust tools like 
[Moralis](https://docs.moralis.io/) and [Wagmi](https://wagmi.sh/) - **which are all Javascript based**.

It's all boils down to the fact that - you'll certainly need Javascript at one point or the other in your career as a blockchain
developer. 

You might still be wondering why you need to "learn Javascript **first**" - this next point addresses that.

- **Javascript is a simpler and loose programming language - hence will be more easy to learn than Solidity**.

Javascript is a simple programming langauge. To add to this, is the fact that it is also a dynamically-typed(you don't need to 
declare types) and loosely typed(it's ability to do **"super-silly"** things like adding/concatenating a **string** to/with a 
**number**) programming language, unlike Solidity which is a statically-typed programming language.

All these **disadvatages** of using Javascript, do serve as potential advantages to folks who are learning it for the first time.
The loose and dynamically-typed nature of Javascript saves you from a "nosy tantrum-throwing compiler" 
that keeps complaining about your code until you get it right. Those complaints can be frustrating - especially for
newbies.

The third reason why it's a good-idea to learn Javascript before Solidity, has to do with **similarity in syntax**.

- **Solidity is quite similar to Javascript syntax-wise**.

The two code-snippets below, show how to write two selected functions from the above smart contract in both Solidity and 
Javascript.

```solidity
// solidity code

    // SPDX-License-Identifier: MIT

    ...

        function setPerson(
            string memory _name,
            uint _favouriteNumber,
            bool _isMale
        ) public {
            programmaticPerson = PersonStruct({
                name: _name,
                favouriteNumber: _favouriteNumber,
                isMale: _isMale
            });
        }

        function getProgrammaticPerson() public view returns (PersonStruct memory) {
            return programmaticPerson;
        } 

    ...

```

```javascript
// javascript code

    ...

        function setPerson(
            _name,
            _favouriteNumber,
            _isMale
        ) {
           programmaticPerson = {
                name: _name,
                favouriteNumber: _favouriteNumber,
                isMale: _isMale
            };

           /* do something with programmaticPerson like 
           using it to update a database, then 'returning' to end the function*/
        }

        function getProgrammaticPerson() {
            return programmaticPerson;
        } 

    ...
    
```

The code snippets above, reveal very practically - the similarity in syntax between Javascript and Solidity.

Both syntax are very similar - except for some extra foreign/unique concepts in both language like how they declare variables
differently, types and return-types, visibility, and storage - all in solidity, and more other differences. 

> Combining the above factor about syntax-similarity and the previous ones - especially the one about Javascript being easier to
learn, it's simply a no-brainer to learn Javascript before taking on Solidity.

### 2. Learn Typescript next.

After learning Javascript, there's still one more hurdle I recommend that you cross before proceeding to learn Solidity. 
**That's Typescript**.

If you're not new to software development, I bet you've heard about Typescript by now. But Just in case you have not;

> Typescript is a **superset** of Javascript. Not really a "programming language" Per se. but more like a tool/compiler that 
serves as a type-checking wrapper for Javascript. 

The term **superset of Javascript** simply means that every Javascript is
valid Typescript. Typescript simply improves Javascript by introducing **types**, hence serving as a statically-typed version of
Javascript that makes up for it's shortcomings.

Below are three code snippets showing a similar way to write the same code in Javascript, Typescript, and Solidity.

```javascript
// javascript code

    ...

    let programmaticPerson

    function setPerson(
        _name,
        _favouriteNumber,
        _isMale
    ) {
        programmaticPerson = {
            name: _name,
            favouriteNumber: _favouriteNumber,
            isMale: _isMale
        };

        /* do something with programmaticPerson like 
        using it to update a database, then 'returning' to end the function */
    } 
    
    ...
    
```


```typescript
// typescript code


    ...

    type Person = {
        name: string;
        favouriteNumber: number;
        isMale: boolean;
    }

    let programmaticPerson: Person;

    function setPerson(
        _name: string, 
        _favouriteNumber: number, 
        _isMale: boolean
        ): void {
        programmaticPerson = {
            name: _name,
            favouriteNumber: _favouriteNumber,
            isMale: _isMale
        };

         /* do something with programmaticPerson like 
        using it to update a database, then 'returning' to end the function */
    }

    ...
        
```

```solidity
// solidity code

    ...

    struct Person {
        string name;
        uint favouriteNumber;
        bool isMale;
    }

    Person private programmaticPerson;

    function setPerson(
        string memory _name,
        uint _favouriteNumber,
        bool _isMale
    ) public {
        programmaticPerson = Person({
            name: _name,
            favouriteNumber: _favouriteNumber,
            isMale: _isMale
        });
    }

    ...
        
```

> As can be seen after a close look at all three code snippets above, it obviously can be deduced that the Typescript code looks
more like Solidity. 

This makes so much sense.

Even though learning Typescript before Solidity is very important(especially in today's current JS/TS ecosystem where Typescript 
is more preferred to Javascript, due to the fact that it helps to write more robust and reliable code), it will still not be 
a compulsory recommendation that you learn Typescript before Solidity - **as long as you already know or can use another 
statically-typed programming language**. 

If you **do not** have a previous experience of working with any statically-typed programming language, then I'll say you should 
take out some time and learn Typescript before proceeding to learn Solidity. A week or two of hardwork should be more than 
enough for that.

Solidity will appear harder and more-complex to learn - if you know only Javascript(or only another dynamically typed programming
language). The main reason for that is the static-typing in Solidity. 

**Having to work with types for the first time can be challenging. And I really won't recommend that you learn to do that 
with a programming language like Solidity.**

> The summary here is very simply: Learn Javascript first due to all the facts explained earlier, then learn typescript
Since the transition process from Javascript to Typescript will be pretty easier.

### 3. Proceed to take some Solidity crash courses.

Now you're ready to take on Solidity. 

But from my years of experience with learning programming languages and/or tools, libraries and frameworks, I still won't recommend that you go "right all in" just yet.

I'll suggest that you start with a crash course first.

> Look around for some(at least 3) Solidity crash content or courses(videos, articles, PDFs or whatever, - 
videos should not exceed 2 hours) and go through them.

By taking a crash course, you'll easily get a good grasp of foundational concepts. This will also help you get coding and building
real projects faster - **which in turn increases/improves the fulfillment level and makes the learning process more rewarding**.

This ["Learn Solidity in 20 Minutes!"](https://www.youtube.com/watch?v=RQzuQb0dfBM) video from the [Dapp University Youtube channel](https://www.youtube.com/@DappUniversity) is one gem of a resource that
I'll recommend to anyone who is working or intending to work with Solidity - **Whether a complete newbie or a good-ole
blockchain pro**.


![Dapp university youtube video screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zykwc0qcyd54x4izm5cp.png)

Do look it up.

### 4. Go all in - into the rabbit-hole.

If you follow the blue-prints in this article from scratch, at this point(after following points 1,2 and 3), 
you will be good with smart-contract to a certain degree already.

Now you can go all in and take any Solidity developer course - irrespective of how monsterous the course may be.

With respect to recommended courses, two awesome ones will be.

1. The [Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript
 – 32-Hour Course](https://www.youtube.com/watch?v=gyMwXuJrbJQ&pp=ygUSMzIgaG91cnNlIHNvbGlkaXR5) by 
 [Patrick Collins](https://twitter.com/PatrickAlphaC).
 

![screenshot of the 'Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript
 – 32-Hour Course'](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7301vy3pdi9dkxrdzofd.png)

 2. The 3 part **Learn Solidity, Blockchain Development, & Smart Contracts | Powered By AI - Full Course**
 also by [Patrick Collins](https://twitter.com/PatrickAlphaC).

 **Part 1**: [https://www.youtube.com/watch?v=umepbfKp5rI](https://www.youtube.com/watch?v=umepbfKp5rI)

 **Part 2**: [https://www.youtube.com/watch?v=sas02qSFZ74](https://www.youtube.com/watch?v=sas02qSFZ74)

 **Part 3**: [https://www.youtube.com/watch?v=wUjYK5gwNZs](https://www.youtube.com/watch?v=wUjYK5gwNZs)

 > Both of these course(individually - which ever you choose) are more than enough to make you a world class blockchain 
 developer. And best deal - "all for free on Youtube"

## Wrapping up.

 There you have it friends, I've done my best in this article - sharing from my learnings: 
 "The best way I think possible, to learn Solidity in 2024". 
 
 I hope it helped/helps.

> This post was originally published on the [Web3 Mastery Website](https://www.web3mastery.org/). Explore [Web3 Mastery](https://www.web3mastery.org/) for more awesome content like this article.

 Cheers!