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
Jenna Phipps is a writer for Webopedia.com, Enterprise Storage Forum, and CIO Insight. She covers data storage systems and data management, information technology security, and enterprise software solutions.
Get the Free Newsletter
Subscribe to Daily Tech Insider for top news, trends & analysis
This email address is invalid.
Get the Free Newsletter
Subscribe to Daily Tech Insider for top news, trends & analysis
This email address is invalid.

Related Articles

Embedded Analytics

Embedded analytics brings self-service business intelligence to everyday application users.

HRIS

Human resources information system (HRIS) solutions help businesses manage multiple facets of their workforce operations. They provide a central platform for human resources professionals...

Complete List of Cybersecurity Acronyms

Cybersecurity news and best practices are full of acronyms and abbreviations. Without understanding what each one means, it's difficult to comprehend the significance of...

Human Resources Management System

A Human Resources Management System (HRMS) is a software application that supports many functions of a company's Human Resources department, including benefits administration, payroll,...

ScalaHosting

ScalaHosting is a leading managed hosting provider that offers secure, scalable, and affordable...

HRIS

Human resources information system (HRIS) solutions help businesses manage multiple facets of their...

Best Managed Service Providers...

In today's business world, managed services are more critical than ever. They can...