문제

Niklaus Wirth wrote a book that popularised the informal equation used as a title: “Data Structures + Algorithms = Programs”. I like to write this equation backwards as in the title of the question, because it hints at a simple but subtle aspect of programming: we are responsible of deciding which ideas of our programs we want to express by data structures and which we want to express with algorithms.

Is there any hint in the book by Niklaus Wirth that he subscribes to or even expresses this view, or is this free interpretation of the informal equation a mere coincidence?


A classical example would be useful to clarify this point. When we implement a finite state automaton we could represent the state using mutually recursive functions – therefore making the state implicit in our program and giving more weight to the “algorithm” part of our program – or using an explicit variable holding the state – thus arbitraging in favour of data structures. In more advanced example, this choice has sometimes a direct incidence on the maintainability or extensibility of programs.

도움이 되었습니까?

해결책

In the preface to the 2004 edition of Algorithms and Data Structures, Wirth states:

Programs are concrete formulations of abstract algorithms based on particular representations and structures of data... Decisions about structuring data cannot be made without knowledge of the algorithms applied to the data and that, vice versa, the structure and choice of algorithms often depend strongly on the structure of the underlying data. In short, the subjects of program composition and data structures are inseparably interwined.

If I understand your question correctly, then yes, I would read from the preceding paragraph that Wirth acknowledges the fluidity of the boundary between algorithms and data structures, and that where that lies for a particular implementation will be influenced by considerations of performance, maintainability, or other factors.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 softwareengineering.stackexchange
scroll top