What is encapsulation? Encapsulation is a simple defensive programming strategy for making code bases behave predictably. It is the practice of hiding data within your class from other classes. Encapsulation allows a class to have control over how and when it’s member variables are modified. This can be done in Java by making all the member variables private and allowing access to them only via getter and setter methods. Let’s say you have a class called “car” with a member variable called “color”.
What is Dependency Injection? To answer that question we must first answer another question: “What is a dependency?”. A dependency is a file your code needs to run/compile properly. Dependencies are usually visible to most devs in the form of “import” statements at the top of their classes/scripts/code. Dependencies are usually thought of as something external to your code that you bring in to make things easier. In the context of dependency injection think of a dependency as another class that’s local to your project but outside of the class you’re working on.
While looking for a new job, a few times I came across trivia style interview questions. Some of them meaningful, some pointless but I realized that I should know some of this stuff. In an effort to either learn the info long term or at least have a place to quickly get an answer I find coherent, I’ve decided to write my own answers as blog posts. First up, the “final” keyword in Java.
In this post I’m going to give an overview of Maven. I won’t explain all it’s features and capabilities in detail. I plan to stick to the important bits. As with anything, if you want to know more, consult Dr. Google. If you’re interested in some tips on how to use Maven rather than learning about the tool itself then check out this post. What is Maven? In short, Maven is a build automation and dependency management tool for Java-based software projects.
What is Maven? Most devs don’t take the time to learn about the technologies they use everyday. We’re busy people and once we’ve beaten the tool or technology into submission then why look any further? It does what you need it to do. However, not taking the time to learn about your most often used tools can have hidden costs. Maven is one such tool. If you’re interested in learning more about what exactly Maven is then check out this post.
In Big-O notation, you’re trying to measure the potential for growth of an algorithm. An algorithm is a set of steps for a computer to take. It takes data in, processes it and provides the output. Since your input can vary in size, so does your output. Changing the size of your input can change the time it takes for your algorithm to complete. The time to complete could grow.