You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My experience as a lecturer is that students get bored if we focus too much on primitive types. Some of Java's build in classes can be introduced earlier, without having to explain how to declare them. This will require explaining the concept of references and state, which is complex, but pretty important to get a grip on early.
String can be used to some extent, but instances with mutable state are also needed. In Python-based courses, lists are introduced early, and my experience is that Java's lists are intuitive enough to come pretty early, and easier to explain than arrays.
The text was updated successfully, but these errors were encountered:
String, LocalDate and LocalDataTime are good examples of immutable objects. They have state, but no way of changing it. Although immutable objects are preferable in many cases, they are not necessarily easier to understand.
StringBuilder (mutable string, which is easier to work with than String for some purposes), (Array)List and (Hash)Map are generally useful, are easy and intuitive enough and illustrate state well. All have a nice (to)String representation, so it's easy to show how sequences of method calls change the state. Lists will be useful for loops, foreach with lists are easier to understand than index-based looping (without explaining in terms of iterators).
It's a bit problematic that the modern way of working with lists and maps often make use of immutable variants created with List.of and Map.of. I wouldn't introduce them, because you would need to explain what List and Map are, as opposed to ArrayList and HashMap, and that quickly becomes far to complex.
A lot about objects can be explained, before needing to explain how they are programmed with classes.
My experience as a lecturer is that students get bored if we focus too much on primitive types. Some of Java's build in classes can be introduced earlier, without having to explain how to declare them. This will require explaining the concept of references and state, which is complex, but pretty important to get a grip on early.
String can be used to some extent, but instances with mutable state are also needed. In Python-based courses, lists are introduced early, and my experience is that Java's lists are intuitive enough to come pretty early, and easier to explain than arrays.
The text was updated successfully, but these errors were encountered: