Code Refactoring 12

Move Accumulation to Collecting ParameterIn this code refactoring tutorial, I’ll show you how to eliminate large Accumulation Methods by Extracting Methods and Using a Collecting Parameter. It sounds complicated but it isn’t!

This tutorial will show you another way to make your code more readable. It will also introduce you to a few jargon terms you will need to know for the future. This video is shorter than normal to focus on topics you need to understand. The code below will help you master this topic.

Continue reading Code Refactoring 12

Code Refactoring 11

Code Refactoring 11One of you guys sent me a request to explain the chapter in Refactoring to Patterns titled Encapsulate Composite with Builder. We will build a table structure (composite) using the Builder design pattern.

I’ll expand the capabilities of the code from this great book to allow us to more easily traverse the tree structure. This will allow us to add children, siblings and item information using a HashMap. This is a beautiful refactoring. All of the code can be found below to help you learn it. Continue reading Code Refactoring 11

Free Video Games

Free Video GamesThe other day I didn’t have time to make a video tutorial, but I wanted to upload something. A great game I recently started playing called Don’t Starve lead to a video you guys seemed to like. (I Gave 1 Copy Away for Free)

I really like games and I’d love to give you guys something. That made me wonder if you’d like me to give away a game at random every week? I’ll still make just as many video tutorials, but I thought this might be fun to add on as an extra video every week. You tell me what I should do in the vote below.

Continue reading Free Video Games

Don’t Starve The Game

Don't Starve Game WalkthroughBecause you guys seem to love games I thought I’d Don’t Starve game walkthrough. This game shows you just how great a 2D game should be. When I start making games, I’m definitely making a game similar to this.

So often beginning developers try to make Atari type or first person shooter games. This is a great example of an easy to design game that has amazing depth. There is so much to learn about game development by just playing this game. I hope you enjoy it. Continue reading Don’t Starve The Game

Code Refactoring 10

Builder Design PatternIn this part of the code refactoring tutorial I’m going to revisit the Builder Design Pattern for a couple of reasons. First, I receive a bunch of questions about it. Secondly, in the next tutorial I’ll show you how to build composites, which were covered in the last part of the code refactoring tutorial, with the builder pattern.

The builder pattern allows you to build complex objects in a series of steps. In the video and code below, we will build sandwiches. Here is he previous tutorial on the Builder Design Pattern to help as well. Continue reading Code Refactoring 10

Code Refactoring 9

Code Refactoring 9In this part of my code refactoring tutorial I will cover how to turn an implied tree structure into a composite pattern.

What do you do when you want to model a tree structure? You can either list the info as primitives and then search through them for what you want or you can create objects that represent each level of the tree with the composite pattern.

I have an additional composite design pattern tutorial here. The code follows to help you learn. Continue reading Code Refactoring 9

Code Refactoring 8

Code Refactoring 8In this part of my code refactoring tutorial, I’ll show you how to eliminate duplicate code using the template method pattern. If you want to see another example of the template method pattern, I cover it here as well Template Method Design Pattern.

When objects perform similar steps in the same order, that is a sign that a template method is needed. To use it implement the similar code in a template method and allow subclasses to override the behavior that varies.

The video and the code below cover all that you need to know.

Continue reading Code Refactoring 8

Install Eclipse for Java

Install Eclipse for JavaI’ve been asked to show you how to Install Eclipse for Java a few times lately. So in this video I’ll show you how to install Eclipse step-by-step.

Not only will I show you how to install eclipse, but I’ll also cover how to install Java, set up code completion and install java libraries.

If you prefer to read these steps look here Install Java 1.7 Eclipse (For Mac and PC) and How to Install Java LibrariesContinue reading Install Eclipse for Java

Code Refactoring 7

strategy design pattern in javaIn this tutorial we’ll work with the strategy design pattern in java. If you want to learn more, check out my strategy design pattern tutorial after this.

We’ll explore how the strategy pattern can be used to eliminate conditionals during code refactoring. We’ll also see how it can make your code more dynamic and flexible. It is a wonderful pattern!

I also revisit your questions about the guard clause and the code is available below. Continue reading Code Refactoring 7

Code Refactoring 6

Code Refactoring 6In this part of the Code Refactoring tutorial I’ll focus on conditionals. Conditional statements can very often make your code very hard to read.

Here we’ll clean up conditional statements by extracting them into methods. We’ll look at how important naming can be to writing understandable code. We’ll take a look at guard clauses and when to use them. Then we’ll see how polymorphism can eliminate conditionals all together.

The code follows the video, to help you learn. Continue reading Code Refactoring 6

Code Refactoring 5

Replace Constructor with Factory MethodIn this part of the code refactoring tutorial, I will show you how to replace a constructor with a factory method in 2 code examples.

I also received a challenge from one of you guys that I will solve. The challenge involves how to create a singleton factory method. It sounds more complicated than it is, but by watching this you’ll learn a lot. Here are some topics you may want to brush up on: Java Reflection, Factory Design Pattern, and the Singleton Design Pattern. Continue reading Code Refactoring 5

Code Refactoring 4

Code Refactoring 4I wanted to cover in this video a bunch of questions I’ve received lately. Everything after this code refactoring tutorial will be more complex.

In this video, we’ll cover converting simple types into class objects. We’ll also look at how to move fields and methods into other classes and a bunch of tricks to get the most out of that. I also show a few of the many ways Eclipse can help you write code quicker. More tips on Eclipse are planned later in the tutorial. All of the code follows the video, to help you learn.

Continue reading Code Refactoring 4

Code Refactoring 3

Code Refactoring Explaining VariablesIn this part of the code refactoring tutorial, I show you examples of how you can make your code more understandable using something called an Explaining Variable.

We also explore many short cuts people take when writing code that will cause many problems later. I want to get these basic rules out of the way so we can concentrate on refactoring to design patterns very soon in this tutorial series.

The code is available below to help you learn.

Continue reading Code Refactoring 3

Code Refactoring 2

Code Refactoring Extracting MethodsIn this part of my code refactoring tutorial I talk about some basic concepts you have to understand. I’ll cover the process of method extraction. This will help you break down many lines of code into understandable blocks. I’ll also cover when not to extract methods and how to handle temporary and local variables.

This tutorial series starts off slow, but by the end many complicated code refactorings will be covered. The code follows the video. Continue reading Code Refactoring 2

Code Refactoring

Code RefactoringWelcome to the beginning of my Code Refactoring tutorial. Code refactoring is used to improve code design to make it easier to understand and extend. Writing understandable code will allow others to easily modify it and in the end you’ll also find you write code faster because of code refactoring.

I explain what it is in the video below as well as cover the refactoring bad smells and 2 code refactorings to get you ready for what is coming. The code used follows the video. Continue reading Code Refactoring

Object Oriented Design Tutorial

Object Oriented Design TutorialHere is my whole Object Oriented Design Tutorial! The goal of this tutorial is to teach you to make beautiful Object Oriented Designs.

I start by creating a Use Case, Object Model, Sequence Diagram and Class Diagram all in the first video. I then turn those diagrams into code and a working program in the second video. I focus on teaching the Object Oriented Design process in numerous ways in this video series.

Links to all of the diagrams and code follow the 11 videos in this series.

Continue reading Object Oriented Design Tutorial

Object Oriented Design 11

Object Oriented Design 11In this tutorial I finish covering the GRASP patterns I covered previously here GRASP Tutorial.

This time talk about Polymorphism, Indirection and Protected Variations. They show how you can create flexibility in your system in different ways by having different classes implement interfaces. I also talk about Pure Fabrication, which shows the importance of separating out code that impedes low coupling. Code follows the video to help you.

Continue reading Object Oriented Design 11