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

Object Oriented Design 10

Object Oriented Design 10In this tutorial, I cover GRASP, or General Responsibility Assignment Software Patterns. GRASP defines rules you can use to decide which objects should have which responsibilities in your Object design.

Here I cover the following rules: Creator, Expert, Coupling, Controller and High Cohesion. The tutorial includes a presentation, code examples, sequence diagrams and class diagrams to make everything understandable and interesting. The code used follows the video.

Continue reading Object Oriented Design 10

Object Oriented Design 9

Object Oriented DesignWelcome to part 9 of my Object Oriented Design tutorial! This all started back in part 3 in my UML Use Case Tutorial.

Here I’ll finish turning sequence diagrams into code. If you get good at this process you’ll be able to make any program no matter how complicated it may be.

All of the code from this and the last tutorial can be found below to help you learn. In the tutorials that follow I’ll answer all of the design pattern tutorials I’ve been receiving. Continue reading Object Oriented Design 9

Torchlight II for Mac

Torchlight II for MacIn this video I’ll show you how to install Torchlight II for Mac. I’ve received many requests on how to play PC games on a Mac. I reached out to those people that made the requests and asked them what game they want to play most. They said they wanted to play Torchlight 2.

So, in this video I’ll show you how to install Windows Steam on Mac. Also I’ll cover how to play PC games on Mac without installing Windows. This works for numerous PC games. JUST TEST THE DEMO VERSION BEFORE YOU BUY!

The only program you’ll need is PlayOnMac. It will install everything else for you. Find other PC games you can play on Mac here. Continue reading Torchlight II for Mac

Object Oriented Design 8

Convert Sequence Diagram into CodeI showed you how to turn your program idea into a Use Case. Then we turned the Use Case into a Domain Model. Then I showed you how to turn the Use Case into a Sequence Diagram. Then we made the Sequence Diagram into a Class Diagram. Now I’m going to show you how to convert the Sequence Diagram into working code.

I make part of the code in this video. The rest will be made in part 9 of my Object Oriented Design Tutorial. All of the code follows the video to help you learn. To get the other diagrams, just click the associated links above.

Continue reading Object Oriented Design 8

UML Video Tutorial

UML Video TutorialUnified Modeling Language (UML) is a graphical way of describing software systems. In this tutorial series, I cover Use Case, Activity, Class, Object, Sequence and many more UML Diagrams.

I can’t think of anything more important for a good programmer to understand than UML. With it you’ll be able to create first class Object Oriented Designs. Those designs will allow you to create anything you can imagine. But, without UML none of these things are possible. Every video and links to all of the code can be found below.

Continue reading UML Video Tutorial

Object Oriented Design 7

Convert Sequence Diagram to Class DiagramIn previous tutorials I showed you how to make a sequence diagram. In this video, I’ll show you how to convert a Sequence Diagram into a Class Diagram. Here are the tutorials on making sequence diagrams if you missed them OOD Sequence Diagrams & Sequence Diagrams 2.

In this tutorial, I wanted to show step-by-step how sequence diagrams are turned into class diagrams. Then in the next video, I’ll turn them both into working code in about 10 minutes. The class diagrams used can be found below.

Continue reading Object Oriented Design 7

Object Oriented Design 6

Object Oriented Design Sequence DiagramIn the last tutorial, I showed you how to create a complicated sequence diagram for our ATM software. In this tutorial, I’m going to simulate the process of creating a sequence diagram in a group atmosphere.

I’ll improve the last design, while explaining what I’m thinking. I’m also trying to teach how to think through a programming problem while creating the sequence diagram.

Both new sequence diagrams follow the video to help you learn. Continue reading Object Oriented Design 6

Object Oriented Design 5

Object Oriented Design Sequence DiagramIn this video I continue building my ATM software using Object Oriented Design principles. If you missed the beginning of this tutorial, the previous videos are here.

If you want to learn everything about Sequence Diagrams, I have you covered as well. I take you through the creation of a sequence diagram using all of the diagrams I made before it. The sequence diagram made in the video follows the video to help you learn. Continue reading Object Oriented Design 5