Side Effect Definition & Meaning
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.
Stay up to date on the latest developments in Internet terminology with a free newsletter from Webopedia. Join to subscribe now.
From A3 to ZZZ we list 1,559 text message and online chat abbreviations to help you translate and understand today's texting lingo. Includes Top... Read More »Huge List of Computer Certifications
Have you heard about a computer certification program but can't figure out if it's right for you? Use this handy list to help you decide. Read More »
Computer architecture provides an introduction to system design basics for most computer science students. Read More »Network Fundamentals Study Guide
Networking fundamentals teaches the building blocks of modern network design. Learn different types of networks, concepts, architecture and... Read More »The Five Generations of Computers
Learn about each of the five generations of computers and major technology developments that have led to the computing devices that we use... Read More »