Skip to content

Instantly share code, notes, and snippets.

@yegor256
Last active April 8, 2024 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yegor256/9c7ac9fbd45469a08eb68cfe09d451c3 to your computer and use it in GitHub Desktop.
Save yegor256/9c7ac9fbd45469a08eb68cfe09d451c3 to your computer and use it in GitHub Desktop.
Research Questions for Pain-of-OOP Course

These research questions are suggested to students of the Pain-of-OOP course:

Q1: In C++ objects are data structures with virtual tables, allocated either on the stack, statically, or on the heap. It would be interesting to find out how most other object-oriented programming languages maintain objects. Do they also represent them as data structures with virtual tables, or perhaps as something else? It would be interesting to analyze not only popular languages but also academic experimental ones, like Self. In the research, it would be interesting to compare different implementations and identify their pros and cons. Maybe we can also do some benchmarking to support our conclusions.

Q2: In object-oriented programming, many design patterns are recommended for use. It’s commonly believed that if programmers adhere to these patterns in their code, the code quality will improve due to clearer design. We hypothesize that most design patterns emphasize the encapsulation of behaviors rather than data. In other words, the objects participating in design patterns are typically “dataless” objects. We propose studying this subject through a Systematic Literature Review (SLR) of existing literature on design patterns, aiming to either confirm or refute our hypothesis. The results of our research might be useful for compiler and programming language designers, prompting them to treat objects differently if they are dataless.

Q3: In object-oriented programming, additional functionality can be added to classes using inheritance, decoration, composition, or by simply expanding existing classes with new code or methods. It is commonly believed that most programmers, especially those with over 10 years of practical coding experience, prefer decoration or composition, as these methods typically result in superior design. To validate this assumption, we propose conducting a survey among a sizeable group of programmers. We’ll present them with various code snippets and ask them to choose a method for modifications. The findings from our research might offer insights to designers of new programming languages about programmers’ perceptions of OOP.

Q4: Earlier studies by various researchers and practitioners have indicated that object-oriented programming features, such as encapsulation and polymorphism, are more performance-intensive compared to their procedural counterparts (like static methods and global variables). However, a direct comparison between programming languages has not been undertaken. We propose such a comparison to determine in which object-oriented programming language programmers incur the highest performance cost for using the object paradigm. The results of this research might assist other researchers in better understanding the practical usability of object-oriented programming.

Q5: The heap is the primary storage for variable-sized memory blocks in modern operating systems and virtual machines. Allocating a slice of bytes in the heap and then releasing it back is a time-consuming operation, requiring several hundred CPU cycles. However, the exact number of cycles it takes to allocate and free memory chunks in different virtual machines and OSs remains unclear (not exactly). We suggest studying this subject, performing experiments on a sufficiently large number of testing platforms, summarizing and analyzing the results, and then publishing a research paper. Such an analysis might assist creators of programming languages and compilers in making better design decisions.

Q6: Dynamic dispatch is one of the two primary sources of performance inefficiencies in object-oriented programming (along with on-heap object allocation). It would be interesting to study the runtime behavior of a number of C++ programs to find out how many object methods are executed, located through virtual tables versus those that are statically linked. This study may help compiler designers understand the importance of devirtualization.

Q7: There are different memory management strategies in C++ and Java. While C++ expects programmers to allocate and release memory blocks explicitly, Java relies on a background process of garbage collection. It would be interesting to setup a benchmarking experiment and compare the performance of object allocations in these two languages. It may be assumed that Java will be faster, but there are no experimental evidence of them have been collected so far (to my knowledge).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment