TransWikia.com

Common questions students may ask when they learn OOP?

Computer Science Educators Asked on March 14, 2021

Reading this question Do we really need OO languages to manage software complexity? on one of SE sites and my own experiences in teaching object-oriented concept, e.g. Some real practical example to teach object-oriented concepts and programming (in python) has kept me wondering what are common questions students may ask when they first learn OOP ?

For example in that question the author asked,

I am a beginning CS student … In the first semester we were introduced to OOP concepts like encapsulation, data hiding, modularity …

But I think all the principles used to manage complexity like
modularity, encapsulation, data hiding and so on can be very easily
implemented by procedural languages. So why really OOP if we can
manage complexity without it?

I also have to admit that I have own struggle, e.g I asked this question Does OOP overemphasize the importance of noun and thus put action/verb in the less importance position ? on that site too (no student has asked me this question though). My question was closed and even got 2 delete votes but that is alway my concern.

If my students or my colleagues who have experience with javascript and like to learn OOP, I will always let them compare momentjs with date-fns, both deal with date and provide the similar functions, both do a good job, but momentjs an OOP library and date-fns is a function library.

My purpose is let them understand there are more than one ways to do things.

So what are common questions your students ask ?

2 Answers

I read through most voted questions tagged object oriented on softwareengineering.stackexchange.com and stackoverflow.com. I feel some questions on softwareengineering site are quite common when learning OOP while questions on stackoverflow are more related to practical programming questions that are more likely asked by professionals.

So I listed some questions from softwareengineering site,

  1. Why is it good to split a program into multiple classes?. This question was indeed asked by a high school student.
  2. Do objects in OOP have to represent an entity?. My students do ask me this question.
  3. What's the benefit of object-oriented programming over procedural programming? this one is somewhat related to the "manage software complexity" question in my question and I do discuss with my colleagues another interesting question that was asked on quora How does Linux maintain such a large code base when C isn't an object oriented language? Is the code base all messed up?
  4. Does OOP fulfill the promise of code reuse? What alternatives are there to achieve code reuse? I am not sure if students will ask this question and I have my own double to the question too.
  5. When writing object-oriented code, should I always be following a design pattern?. This site also has a question about design pattern, How bad is a Computer Science course that doesn't teach Design Patterns?
  6. Explanation on how “Tell, Don't Ask” is considered good OO. Only after they gain some coding experiences can they ask/appreciate the question. But it is a good one.
  7. Should I create a class if my function is complex and has a lot of variables? One answer there was also my recommendation to my students when they have such question, "Use a class, but also provide a free standing function, that only constructs the object, calls the method and returns the result, the class that you use internally really becomes just an implementation detail of your public function"

Quora also has some interesting questions I feel people will ask when they first learn OOP, I list some here:

  1. Can anyone (in a programmer's position) survive in the modern tech industry (software or no software) without OOP?
  2. How often do software developers use OOP?. One answer there by Kurt Guntheroth is interesting "Any time you write a program longer than about 1,000 lines, you should use OOP. 1000 lines? Why’s that ...?"
  3. When is object-oriented programming not a good fit?

Hopefully I can get some other answers.

Answered by Qiulang on March 14, 2021

This is a really nice question! Your answer covers a lot of ground too.

I’d like to offer a reflection on what might motivate these questions.

In my experience, learners who encounter OOP early in their journey have to wrestle with a few different challenges, including:

  1. They’ve not yet experienced the problem/s that OOP solves.
  2. They believe that there is a perfect solution to all programming challenges waiting to be discovered.

These give rise to a whole load of questions, confusions and, in some cases, insecurities.

Answered by Eddie on March 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP