Browse Definitions :
Definition

strongly typed programming language

What is a strongly typed programming language?

A strongly typed programming language is one in which each type of data, such as integers, characters, hexadecimals and packed decimals, is predefined as part of the programming language, and all constants or variables defined for a given program must be described with one of the data types. Certain operations might be allowable only with specific data types.

Strongly typed programming language refers to an idea that describes the enforcement of firm restrictions on mixing different data types and values. When there is a violation, errors, also known as exceptions, occur. Strongly typed programming languages use a language compiler to enforce data typing compliance.

The typical steps performed by a compiler
A language compiler is used to enforce data typing compliance for strongly typed programming languages.

Advantages and disadvantages of strongly typed programming languages

Strongly typed programming languages have their benefits and drawbacks.

A key advantage of strong data typing is that it enforces a rigorous set of rules to ensure a certain consistency of results. Further, a compiler can quickly detect an object being sent a message to which it will not respond, preventing runtime errors. Other benefits include no runtime penalties for determining types, accelerated development by detecting errors earlier and better-optimized code from the compiler.

However, a major disadvantage of using a strongly typed programming language is that programmers lose flexibility. For example, strongly typed programming languages prevent the programmer from inventing a data type not anticipated by the developers of the programming language. It limits how creative one can be in using a given data type. Strong typing in a programming language also makes it more challenging to define collections of heterogeneous objects.

The programming lifecycle
Runtime is the final stage of the programming lifecycle.

Strongly vs. loosely typed programming languages

In computer programming, a programming language is strongly typed if it demands the specification of data types. A programming language is loosely typed, or weakly typed, when it does not require the explicit specification of different types of objects and variables. The "looser" typing rules in weakly typed programming languages can produce erroneous or unpredictable results. It can execute implicit type conversions at runtime.

In programming languages, the concepts of strong and weak, or loose, typing are related to but different from static and dynamic typing. A programming language that is strongly typed can be either statically or dynamically typed.

In static typing, type checking takes place at compile time and catches such things as missing functions, invalid type arguments, or a mismatch between a data value and the type of variable to which it's assigned -- before the program has a chance to run the erroneous code and risk crashing. In dynamically typed languages, type checking occurs at runtime, so the compiler will ignore invalid type arguments or mismatched data. If the type checker detects an error, it will alert the developer to repair the code to avoid the program crashing.

Examples of strongly and loosely typed programming languages

Here are some examples of strongly typed and loosely typed programming languages.

Strongly typed programming languages include the following:

Loosely typed programming languages include the following:

Why is Java a strongly typed language?

Java is considered strongly typed because it demands the declaration of every variable with a data type. Users cannot create a variable without the range of values it can hold. Once declared, the data type of the variable cannot be changed.

Why is Python a strongly typed language?

Python is strongly typed because the interpreter keeps track of all variable types. Python can be very dynamic, as it rarely uses this information to limit variable usage.

Is C a strongly or weakly typed programming language?

C is strongly typed in that the variable type must be specified when declaring the variable. However, C can also be regarded as weakly typed because users can convert data types through a cast and without compiler errors.

Why is C++ a strongly typed programming language?

The C++ programming language is considered strongly typed and has parametric polymorphism available through templates. This means you can create a set of generic data types and accurately represent them.

Why is C# a strongly typed programming language?

C# is a strongly typed programming language as all variable types have to be specified, and all errors are detected and flagged during compilation.

Why is JavaScript a weakly typed programming language?

Unlike C#, JavaScript is a weakly typed programming language because you do not have to specify the variable type in advance.

Explore dead programming languages we should never forget and a comparison of top programming languages

This was last updated in June 2022

Continue Reading About strongly typed programming language

Networking
  • firewall as a service (FWaaS)

    Firewall as a service (FWaaS), also known as a cloud firewall, is a service that provides cloud-based network traffic analysis ...

  • private 5G

    Private 5G is a wireless network technology that delivers 5G cellular connectivity for private network use cases.

  • NFVi (network functions virtualization infrastructure)

    NFVi (network functions virtualization infrastructure) encompasses all of the networking hardware and software needed to support ...

Security
  • virus (computer virus)

    A computer virus is a type of malware that attaches itself to a program or file. A virus can replicate and spread across an ...

  • Certified Information Security Manager (CISM)

    Certified Information Security Manager (CISM) is an advanced certification that indicates that an individual possesses the ...

  • cryptography

    Cryptography is a method of protecting information and communications using codes, so that only those for whom the information is...

CIO
  • B2B (business to business)

    B2B (business-to-business) is a type of commerce involving the exchange of products, services or information between businesses, ...

  • return on investment (ROI)

    Return on investment (ROI) is a crucial financial metric investors and businesses use to evaluate an investment's efficiency or ...

  • big data as a service (BDaaS)

    Big data as a service (BDaS) is the delivery of data platforms and tools by a cloud provider to help organizations process, ...

HRSoftware
  • talent acquisition

    Talent acquisition is the strategic process an organization uses to identify, recruit and hire the people it needs to achieve its...

  • human capital management (HCM)

    Human capital management (HCM) is a comprehensive set of practices and tools used for recruiting, managing and developing ...

  • Betterworks

    Betterworks is performance management software that helps workforces and organizations to improve manager effectiveness and ...

Customer Experience
  • martech (marketing technology)

    Martech (marketing technology) refers to the integration of software tools, platforms, and applications designed to streamline ...

  • transactional marketing

    Transactional marketing is a business strategy that focuses on single, point-of-sale transactions.

  • customer profiling

    Customer profiling is the detailed and systematic process of constructing a clear portrait of a company's ideal customer by ...

Close