Xref: utzoo comp.object:2357 comp.lang.functional:552 Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!rutgers!usc!petunia!news From: jdudeck@polyslo.CalPoly.EDU (John R. Dudeck) Newsgroups: comp.object,comp.lang.functional Subject: Global program state. Message-ID: <27823155.211e@petunia.CalPoly.EDU> Date: 2 Jan 91 19:15:33 GMT Reply-To: jdudeck@polyslo.CalPoly.EDU (John R. Dudeck) Organization: Cal Poly State Univ,CSC Dept,San Luis Obispo,CA 93407 Lines: 38 In the book, _Principles of Functional Programming_, by Glaser, Hankin, & Till, it is stated, "the notion of global state that may change arbitrarily at each step of the computation has proved to be both intuitively and mathematically intractable." In classical structured programming, the use of global state was discouraged, but programmers tended to be undisciplined, and there never was any clear philosophy on how storage should be structured in a program. The solution offered by functional programming is to eliminate all state from programs. A functional program passes data around without ever storing it anywhere. In object-oriented design, the approach is to eliminate all shared data areas, and to encapsulate any state so that all access to it is localized. The argument of advocates of functional programming is that if you don't have a program state (i.e. side effects), you don't have to worry about anything going wrong. The advocates of object-oriented design say that it's easier to design and maintain a program where you nail down the state of something in an object, and keep the state encapsulated so that it can't be touched. Is the issue of program state really the crux of the issue of program tractability and of control of complexity in software engineering? It seems to me that the ability to localize program state is an essential requirement, but I don't see why it should be necessary to eliminate it altogether, as in functional programming. -- John Dudeck "If it's Object Oriented then by jdudeck@Polyslo.CalPoly.Edu definition it's A Good Thing". ESL: 62013975 Tel: 805-545-9549 -- D. Stearns