Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 233

Notes

Оглавление

1 Object oriented programming refers to the programming style that provides a methodology that enables a logical system (real life concept, such as for example “student”)) to be modelled an “objects.” In further code it will then be possible to address this object via its methods and attributes. For example, the object student can have a method “age” that returns the age of the student based in its attribute birth-date.

2 The reader that has knowledge of C, might want to know that this is the object-like functionality that is provided by the struct keyword in C. R is written in C and to program base-R one used indeed those structures.

3 Experienced C-users might want to think of this as something like the statement switch(TYPEOF(x)) in C.

4 A good way to see a generic function is as an overloaded function with a twist.

5 Sometimes generic functions are also referred to as “generics.”generic

a How to measure and improve speed is described in Chapter 40 “The Need for Speed” on page 793.

6 Notice that there are no objects of these names in base R, but for example you will find some in the methods package. This package provides formally defined methods and objects for R.methods

a UppercamelCase is easy to understand when comparing to lowerCamelCase, the dot.separator and snake_case. It refers to the way long names (of objects, variables and functions) are kept readable in code. They are all good alternatives, and each programmer has his/her preference, though in many communities, there are some unwritten rules. These rules are best followed because that makes your code much easier to read.

7 R5 has recently been added to R (2015). It responds to the need formutable objects and as such makes packages such as R.oo, proto and mutatr obsolete.

10 a The development of R6 can be followed up here: https://www.r-project.org/nosvn/pandoc/R6.html

The Big R-Book

Подняться наверх