Hot answers tagged

6

Static members belong to the type, not the instance Static members are best seen as belonging to the type rather than the instance. If you're inside a class, it can be harder to see: class Animal { static int moveSpeed = 4; int currentLocation = 10; void Walk() { // Can you tell which variable is static without looking above? ...


6

I use school colors and principal's name. If someone comes in tomorrow and says your principal is no longer Mr. Smith, it's now Ms. Jones then that change is made for every object (student) in the school. You don't have to go to each individual student and tell them that their principal has changed. It worked really well this year because we did get a ...


5

One way to approach this might be to have students identify what they all have in common and what they each possess individually. That which is common -- like the school they are attending or the class (and maybe grade level) they are in -- should be static. That which is not -- like name or age -- should not be static. You could also go into sufficient ...


3

Static is within the AP subset and is fair game for the examination. Oddly enough, the memory model of Java that operates here is not, so students could, hypothetically, memorize a series of arbitrary rules and be fine here. If you think it seems silly to teach about static without at least giving a passing understanding of how memory works, then you and I ...


3

An example of static, "preferably something that high-school students can relate to and understand", would be the instructor. Each period for the Computer class has different students, different times, maybe different assignments (to prevent cheating) but the instructor stays the same. It's still a member, since the English class has a different instructor (...


2

Another classification criterium would around the type of exercise. Some exercises are 'here is a problem, write a piece of code to solve it' or 'design a (piece of a) software system'. Others are 'here is some partial code, or code with a mistake, complete or fix it'. Another type is given correct code with the lines in randomised order, put the lines in ...


2

In one sense this is hopeless as you probably can't come up with a classification that everyone would agree with. On the other hand, it is certainly possible for you to come up with a classification that is useful to you and to other people who think and teach like you do. However, the real problem is that "what is elementary" is bound up with teaching ...


2

If one understands objects, fields, and variables, static fields should be easy to understand (e.g. as fields of a "class object"). And if one does not understand objects, one can not apply OOP or software design, which makes it very hard (maybe even impossible) to really understand that material. Therefore, a solid and accurate understanding of objects, ...


1

Here's an answer that will not make you happy. If you need an analogy, maybe the concept is too complex to be taught? The literature on CS education does not show a lot of support for analogical teaching; in fact, analogies often get in the way and create as much confusion as they help. People have pointed to the need to have clear and crisp notional ...


Only top voted, non community-wiki answers of a minimum length are eligible