For aspiring young software developers who are trying to master Java, or software developers who are experienced with other languages and are making the move to Java EE, it's often reassuring, especially when things get confusing, that under the covers, even the most complicated object-oriented concepts break down simply into the basics of imperative programming where the ultimate goal is nothing more than figuring out how to effectively change the state of a given variable.
Every software development problem boils down to the very basic concepts that are common to all imperative programming paradigms.
Variables, be it inside of functions or part of the classes as attributes, the control structures and functions that manifest themselves as methods are simply Java's implementation of the universal structures that are common to all imperative programming languages.
Variables: the foundation of imperative programming
Think about variables. Variables are just groups of binary bits stored in memory. And while knowing the underlying implementation isn't always necessary, knowledge of the underpinnings can be very helpful. For example, if you use a Java int to store a user's age you’ll spend four times as much memory as you would actually need. Multiply this waste for many attributes and you’ll have a significant amount of wasted space. This may not be a huge issue on a server sporting peta-bytes of storage space, but it might lead to software that simply can’t run in memory-starved smartphones.
Of course, software programming involves more than just storing data as variables. Programmers must use conditional logic and iterative structures to solve problems. In the Java universe, this means mastering if...else and switch constructs and four or five basic iterative structures including for, while and do...while loops. But that's really it. All software solutions boil down to these basic ideas, namely that data that is stored in variables being manipulated conditionally within iterative loops.
Getting back to basics
Mastering object orientation can be a challenge, and learning all of the various techniques and technologies that allow a developer to effectively perform all aspects of application lifecycle management can certainly be intimidating. But when it comes to learning and mastering the Java language, remember that in the end, every software development problem boils down to the very basic concepts that are common to all imperative programming paradigms, and if you can master these relatively simple concepts, namely managing variables, performing conditional logic and writing iterative loops, the more complicated concepts will quickly fall into place as well.
Do you have any good strategies for simplifying complex and intimidating problems? Let us know how you approach difficult programming problems.