Static Typing vs. Dynamic Typing

Some Dude Says
The Startup
Published in
7 min readDec 21, 2019

--

Featured image by Pexels from Pixabay

The decision on how to type a language affects everything about the functioning of the language. From variables to general program flow, every part of the language will be shaped around what typing a language uses. There are several different types of typing which can impact a language, but we’re going to focus on the difference between static typing and dynamic typing.

Typing refers to data types and how “rigid” they are. How is data stored and how can it be accessed? How is typing enforced? What are some common misconceptions about typing? All these are concerns and all of these affect which language ends up best for your project.

Static Typing

Static typing refers to when data types need to be static at run time. This means they need to be set properly at compilation and cannot change without a properly defined operation in the language (usually a cast). Compilation doesn’t just mean this is something true for compiled languages either. Many interpreted languages use a just in time compiler or similar technique to compile the script into byte code on execution.

For instance, in C#:

string s = "This is a string";
int myNumber = 35;
double myDecimal = 35.0001;

Each of these variables has a defined type which has defined interactions. You can’t just go…

--

--

Some Dude Says
The Startup

I write about technology, linguistics (mainly Chinese), and anything else that interests me. Check out https://somedudesays.com for more from me!