refactoring

<programming>

Improving software by changing its internal structure without altering its external behaviour.

When software developers add new features to code, it generally degrades because it was not designed with the extra features in mind.

This is solved by either rewriting the code or working around the problem. Rewriting code is extra work, but not doing so results in code that is increasingly and unnecessarily complicated.

Refactoring restructures code to clarify and simplify its design. This may involve extracting reusable code, removing duplicate code, adding features to make the code easier to alter in future, renaming functions and variables, reorganising classes and data structures.

"Refactoring, Reuse & Reality" by Bill Opdyke.

"Refactoring, a first example" by Martin Fowler.

Last updated: 2020-08-19

REFAL

Recursive Functional Algorithmic Language

REF-ARF

["REF-ARF: A System for Solving Problems Stated as Procedures", R.E. Fikes, Artif Intell J 1(1), Spring 1970].

Last updated: 1998-06-29

reference

pointer

reference counting

<programming>

A garbage collection technique where each memory cell contains a count of the number of other cells which point to it. If this count reaches zero the cell is freed and its pointers to other cells are followed to decrement their counts, and so on recursively.

This technique cannot cope with circular data structures. Cells in such structures refer (indirectly) to themselves and so will never have a zero reference count. This means they would never be reclaimed, even when there are no references from outside the structure.

Last updated: 1995-02-22

referential integrity

<database>

A collection of properties which should be possessed by data in a relational database.

For example, in a database of family members, if we enter A as a spouse of B, we should also enter B as a spouse of A. Similarly, if we remove one end of the relationship we should also remove the other.

Last updated: 1998-02-18

referentially transparent

referential transparency

referential transparency

<programming>

An expression E is referentially transparent if any subexpression and its value (the result of evaluating it) can be interchanged without changing the value of E. This is not the case if the value of an expression depends on global state which can change value. The most common example of changing global state is assignment to a global variable. For example, if y is a global variable in:

 f(x)
 { return x+y; }

 g(z)
 {
   a = f(1);
   y = y + z;
   return a + f(1);
 }

function g has the "side-effect" that it alters the value of y. Since f's result depends on y, the two calls to f(1) will return different results even though the argument is the same. Thus f is not referentially transparent. Changing the order of evaluation of the statements in g will change its result.

Pure functional languages achieve referential transparency by forbidding assignment to global variables. Each expression is a constant or a function application whose evaluation has no side-effect, it only returns a value and that value depends only on the definition of the function and the values of its arguments.

We could make f above referentially transparent by passing in y as an argument:

 f(x, y) = x+y

Similarly, g would need to take y as an argument and return its new value as part of the result:

 g(z, y)
 {
   a = f(1, y);
   y' = y+z;
   return (a + f(1, y'), y');
 }

Referentially transparent programs are more amenable to formal methods and easier to reason about because the meaning of an expression depends only on the meaning of its subexpressions and not on the order of evaluation or side-effects of other expressions.

We can stretch the concept of referential transparency to include input and output if we consider the whole program to be a function from its input to its output. The program as a whole is referentially transparent because it will always produce the same output when given the same input. This is stretching the concept because the program's input may include what the user types, the content of certain files or even the time of day. If we do not consider global state like the contents of files as input, then writing to a file and reading what was written behaves just like assignment to a global variable. However, if we must consider the state of the universe as an input rather than global state then any deterministic system would be referentially transparent!

See also extensional equality, observational equivalence.

Last updated: 1997-03-25

referer

<web>

A misspelling of "referrer" which somehow made it into the HTTP standard. A given web page's referer (sic) is the URL of whatever web page contains the link that the user followed to the current page. Most browsers pass this information as part of a request.

Last updated: 1998-10-19

referrer

referer

REFINE

1. "Research on Knowledge-Based Software Environments at Kestrel Institute", D.R. Smith et al, IEEE Trans Soft Eng, SE-11(11) (1985). E-mail: <[email protected]>.

2. Cordell Green et al, Stanford U. Uses logic to specify and evolve programs. [same as 1?] Reasoning Systems, Inc. E-mail: <[email protected]>.

Refined C

(RC) An extension of C to directly specify data access rights so that flow analysis, and hence automatic parallelisation, is more effective. Research implementations only. "Refining A Conventional Language For Race-Free Specification Of Parallel Algorithms," H.G. Dietz et al, Proc 1984 Intl Conf Parallel Proc, pp.380-382.

Refined Fortran

(RF) Similar to Refined C. Research implementations only. "Refined Fortran: Another Sequential Language for Parallel Programming," H.G. Dietz et al, Proc 1986 Intl Conf Parallel Proc, pp.184-191.

reflexive

<theory>

A relation R is reflexive if, for all x, x R x.

Equivalence relations, pre-orders, partial orders and total orders are all reflexive.

Last updated: 1999-01-28

reflexive domain

A domain satisfying a recursive domain equation. E.g. D = D -> D.

Reflexive transitive closure

Two elements, x and y, are related by the reflexive transitive closure, R+, of a relation, R, if they are related by the transitive closure, R*, or they are the same element.

RefLisp

<language>

A small Lisp interpreter written in C++ by Bill Birch of Bull, UK. RefLisp has a built-in web server, Wiki, LISP server pages, SQL Databases, XML parser, MD5 hashing, regular expressions, reference counting and mark-sweep garbage collection.

RefLisp has shallow-binding and dynamic scope with optional support for lexical scope, Common Lisp compatibility and for indefinite extent Scheme programs.

RefLisp is distributed under the GPL.

RefLisp Home.

Last updated: 2005-02-08

refresh

<storage>

1. DRAM refresh.

<hardware>

2. screen refresh.

Last updated: 1998-10-19

refreshable braille display

braille display

refreshable display

braille display

refresh rate

<hardware>

(Or "vertical refresh rate", "vertical scan rate") The maximum number of frames that can be displayed on a monitor in a second, expressed in Hertz.

The scan rate is controlled by the vertical sync signal generated by the video controller, ordering the monitor to position the electron gun at the upper left corner of the raster, ready to paint another frame. It is limited by the monitor's maximum horizontal scan rate and the resolution, since higher resolution means more scan lines. Increasing the refresh rate decreases flickering, reducing eye strain, but few people notice any change above 60-72 Hz.

Last updated: 1999-08-01

refuctoring

<humour, programming>

Taking a well-designed piece of code and, through a series of small, reversible changes, making it completely unmaintainable by anyone except yourself. The term is a humourous play on the term refactoring and was coined by Jason Gorman in a pub in 2002.

Refuctoring techniques include:

Using Pig Latin as a naming convention.

Stating The Bleeding Obvious - writing comments that paraphrase the code (e.g., "declare an integer called I with an initial value of zero").

Module Gravity Well - adding all new code to the biggest module.

Unique Modeling Language - inventing your own visual notation.

Treasure Hunt - Writing code consisting mostly of references to other code and documents that reference other documents.

Rainy Day Module - writing spare code just in case somebody needs it later.

Waterfall 2006 presentation.

Last updated: 2013-12-01

refutable

<programming>

In lazy functional languages, a refutable pattern is one which may fail to match. An expression being matched against a refutable pattern is first evaluated to head normal form (which may fail to terminate) and then the top-level constructor of the result is compared with that of the pattern. If they are the same then any arguments are matched against the pattern's arguments otherwise the match fails.

An irrefutable pattern is one which always matches. An attempt to evaluate any variable in the pattern forces the pattern to be matched as though it were refutable which may fail to match (resulting in an error) or fail to terminate.

Patterns in Haskell are normally refutable but may be made irrefutable by prefixing them with a tilde (~). For example,

 (\ (x,y) -> 1) undefined	==>	undefined
 (\ ~(x,y) -> 1) undefined	==>	1

Patterns in Miranda are refutable, except for tuples which are irrefutable. Thus

 g [x] = 2
 g undefined	 	==>	undefined

 f (x,y) = 1
 f undefined	 	==>	1

Pattern bindings in local definitions are irrefutable in both languages:

 h = 1 where [x] = undefined	==>	1

Irrefutable patterns can be used to simulate unlifted products because they effectively ignore the top-level constructor of the expression being matched and consider only its components.

Last updated: 2013-11-03

Nearby terms:

re-engineeringre-entrantrefactoringREFALREF-ARFreference

Try this search on Wikipedia, Wiktionary, Google, OneLook.



Loading