6 ms·
I think you missed OP's point. Beginner programmers introduced to Java are forced to grapple with OO from the outset. What is a class or static method? These a
by possibilistic 13y ago
I think you missed OP's point. Beginner programmers introduced to Java are forced to grapple with OO from the outset.
What is a class or static method? These are OO constructs and require additional mental overhead when learning.
- ericHosick 13y agoThey also struggle with functions, parameters, pointers, scope and so on. You don't need to pass parameters to your car to start it. You don't need to force yourself to only focus on the recipe (scope) when making dinner. None of these things map very well with the real world and could also be considered additional mental overhead when learning. You don't need to know how to code to learn best known practices in building software.
- kazagistar 13y agoFunctions, parameters, and pointers are also optional concepts in python. None of them are needed in a hello world program, nor for a few weeks into an introductory course. Variables, expressions, conditionals, lists, strings, and loops can all exist on their own without any "extra stuff". Learn things one at a time; "best practices" can wait til you can demonstrate why it is a best practice. Why should I make a function? Until you actually face the problems that abstractions are used to solve, learning them is confusing and difficult.
- nightski 13y agoOptimizing for hello world is probably the least important thing when you have a 10+ year journey of learning ahead of you. In the end, what do you learn from python's hello world anyways? This also happens in math quite a bit. There is a knowledge gap when teaching concepts like derivatives for the first time. So we are told to initially ignore details while learning.
- groovy2shoes 13y agoThat's probably why I didn't understand derivatives until Calc 3. I barely passed Calc 1 and 2 because my professors just told us to ignore the details. My Calc 3 professor actually showed us how everything worked, from intuition to theorem to proof. In my experience, it's best not to delay learning the details. You don't have a real understanding of something until you understand the details.
- nightski 13y agoYou are right, it is quite bad to ignore the details in the long run (it requires patience of course). However that makes even less of a case for Python.
- groovy2shoes 13y agoIt's far easier to understand the concepts piecemeal. Methods are easier to understand if you already grok functions. Integrals are easier to understand if you already grok derivatives. When learning these things, you're often fed an over-simplified explanation so that the instructor can go on to cover something more advanced. The problem is that now you're trying to learn something more advanced before you've got a solid understanding of the primitives.
- deleted 13y ago[deleted]
- bad_user 13y agoAnd you missed my point. Static methods are not an OOP construct, unless we would be talking about class methods on classes that are objects themselves, but in Java we don't.
- bybjorn 13y agoNonetheless, beginners will still have to be introduced to the concepts from the start.
- Goladus 13y agoOnly a few of them. I'd say: 1. Instantiate Object. 2. Invoke Method. 3. Get or modify attribute. 4. Do some introspection (even if the term is not used) Most importantly, learning how to define their own classes isn't really important for beginners.
- jfarmer 13y agoThose are the concepts starting the beginner in the face, sure. Here some of the questions a beginner will have, phrased ~10x more clearly than a beginner would ever be able to phrase them: 1. What is an object? 2. What does it mean to "instantiate" an object? 3. What is a method? 4. What does it mean to "invoke" a method? 5. What is an attribute? 6. What does it mean to "get" an attribute? 7. What does it mean to "modify" an attribute? 8. What is introspection? And so on, until we run into a concept through which we can explain something. The idea of an "object" is a big hurdle for beginners, especially if they don't have experience writing code — it seems like weird boilerplate. Likewise, "introspection" and other meta-concepts are incredibly challenging for beginners because they have a hard time stepping "out of the code," so to speak.
- Goladus 13y agoThe thing is, students don't need to be able to ask those questions to learn the concepts. It can be done as an interactive exercise and in the process, a student will actually see what objects are used for and gain intuitive understanding. You do not need to go into all the cumbersome detail about how they are defined in the language. Critically, you do not need to introduce concepts that require them to decide whether they should define their own classes or use built-in data types. Here is an example that instantiates an object, introspects, gets an attribute, introspects again, and invokes a method. It's 11 commands. >>> import requests >>> def introspect(obj): ... for x in dir(obj): ... print x ... >>> request_object = requests.get('https://news.ycombinator.com/item?id=6919275') >>> introspect(request_object) __bool__ __class__ __delattr__ __dict__ [...] request status_code text url >>> request_object.status_code 200 >>> request_object.url u'https://news.ycombinator.com/item?id=6919275' >>> introspect(request_object.url) __add__ __class__ __contains__ __delattr__ [...] title translate upper zfill >>> request_object.url.upper <built-in method upper of unicode object at 0x29a3330> >>> request_object.url.upper() u'HTTPS://NEWS.YCOMBINATOR.COM/ITEM?ID=6919275' After enough practice using objects from various python libraries, in the course of doing functional or imperative programming, they will have an intuitive understanding of objects and what they are for. Some interested students might ask "What's an object, under the hood?" and "how can I create my own classes?" That's when you can introduce them to classes (http://docs.python.org/2/tutorial/classes.html http://docs.python.org/2/tutorial/classes.html). If they're fine with the intuitive understanding that comes with performing examples like the one above, leave them be. Don't inflict OOP principles they don't need to know yet.