Side Effect

A side effect in programming occurs when executing a function results in something else happening other than strictly performing the function and receiving the standard output. This might mean that a variable‘s value changes while being calculated in a function. Declarative programming languages rarely have side effects; the code is straightforward and does not detail every step needed to complete a function. If the objects they use are immutable, which in declarative programming they typically are, functions will behave the same each time they run, without having side effects in another part of the program.

A side effect often changes the state of the program itself, not just the local area in which it appears. This is sometimes known as a “global” change, when it changes the values of variables outside that particular function’s local area. Of course, for an application or computer program to work, it does need to allow modification through side effects: outputs sometimes must change. And databases will have many side effects as data changes and mutates. But there are benefits to purely functional programming as well.

Functional programming, which avoids side effects, is easier for developers to read and analyze. Pure functions (which have no side effects) perform the same calculation each time they are repeated, with no variation or side effect. Avoiding side effects in a program makes it more readable and reliable.






Jenna Phipps
Jenna Phipps is a contributor for websites such as Webopedia.com and Enterprise Storage Forum. She writes about information technology security, networking, and data storage. Jenna lives in Nashville, TN.

Top Articles

The Complete List of 1500+ Common Text Abbreviations & Acronyms

From A3 to ZZZ we list 1,559 SMS, online chat, and text abbreviations to help you translate and understand today's texting lingo. Includes Top...

Windows Operating System History & Versions

The Windows operating system (Windows OS) refers to a family of operating systems developed by Microsoft Corporation. We look at the history of Windows...

How to Create a Website Shortcut on Your Desktop

Website Shortcut on Your Desktop reviewed by Web Webster   This Webopedia guide will show you how to create a website shortcut on your desktop using...

Generations of Computers (1st to 5th)

Reviewed by Web Webster Learn about each of the 5 generations of computers and major technology developments that have led to the computing devices that...

Pardot

What is Pardot? Pardot is a B2B marketing automation (MA) solution by Salesforce that...

Veeam

Veeam Software is a global vendor...

Akamai

Akamai Technologies is a global web technology company specializing in content...