5
$\begingroup$

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 ?

$\endgroup$
4
  • 2
    $\begingroup$ This depends on when OO concepts are introduced. It is quite different if you teach objects early than if you teach them late. $\endgroup$ – Buffy Jan 19 at 10:46
  • $\begingroup$ @Buffy I provide an answer in order to get more (I hope) $\endgroup$ – Qiulang Jan 20 at 4:02
  • $\begingroup$ As a side note. I have noticed a difference between teaching a feature (iteration, encapsulation, etc) and teaching a problem and a solution. I have not as yet decided on the best strategy. But think that a solution (language feature) without a problem is hard to learn. This will also make it hard to learn constrained iteration (foreach item in list: process(item)), after unconstrained iteration (for i is 0 while i< length(list): process( item i of list); add one to i ), as constrained will seem like it is not needed (as it is not needed, but it does make the code simpler). $\endgroup$ – ctrl-alt-delor Jan 20 at 10:29
  • $\begingroup$ Totally agree, that was the reason I asked 2 other questions here cseducators.stackexchange.com/questions/6699/… and cseducators.stackexchange.com/questions/6709/… both emphasize the word "practical"! $\endgroup$ – Qiulang Jan 20 at 10:33
4
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ Your point #2 is pretty universal: rationality asserts the ability to solve problems. It is the Juggernaut that is the only tool which eventually will solve every problem. And, to a kid with a Juggernaut, everything is something to drive over. If we could teach people only one thing, it should be that thoughts can be wrong, too. Skepticism of mental processes would reduce suffering dramatically, including for students. (I think the Buddha said that. Or maybe it was Socrates. Abraham? Confucius...) $\endgroup$ – Scott Rowe Feb 12 at 17:55
  • $\begingroup$ In my experience in teaching grade 11 and 12, early'ish OOP is better than late. If students don't learn OOP in grade 11, it feel like breaking (bad?) habits in grade 12. I also feel the same about functions. I have grade 9s build games is Scratch that are quite modular with custom blocks. I think making decomposition and modularity core components early on helps all learners. Without it, I find the weaker students struggle with advanced algorithms, and the strong students try to brute force the solution successful, but their code is a mess. $\endgroup$ – TooManyCooks Feb 18 at 0:08
  • $\begingroup$ Another reason maybe because GUI is everywhere (especially for kids never touch linux world) , students may tend to feel OOP is THE solution for every programming problem. $\endgroup$ – Qiulang Feb 23 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.