In the previous part of my Object Oriented Design Tutorial, I showed you how to build a Use Case, Object Model, Sequence Diagram and Class Diagram from scratch.
In this tutorial, I show you how to turn those diagrams into code and a working program. This is the process a person goes through to create excellent Object Oriented Designs. The code follows the video along with the digrams from last time.
If you like topics like this, it helps to tell Google with a click here [googleplusone]
If you know anyone interested in Object Oriented Design, feel free to share [nttfblike]
Code from the Video
COIN.JAVA
PLAYER.JAVA
COINGAME.JAVA
COINFLIPPINGGAME.JAVA
Object Oriented Design Diagrams
Click on the image below a few times to see it full screen

hi derek, too bad you switched to java, i really liked your video’s
What language did you prefer? I’m constantly planning for the future
C++ would be great, if you can do it.
Thanks.
That tutorial is coming in the games tutorials. I’ll have to cover C first though
I’d like to have it on PHP. But you’re videos were great. Thanks for sharing.
You’re very welcome 🙂 I’ll cover php in detail after I finish with Java
Great video series (as they all are)! One slight bug in the code is that it appears the coin is only flipped one time instead of once per game. (Random coin flip occurs in Coin’s constructor and a Coin object is only created once.) Still, I wish I could write virtually bug-free code off the top of my head as you can!
Thank you very much 🙂 I’ll look into that bug and thank you for pointing it out. Sometimes I focus so much on the core subject that I let little silly things slip. Sorry about that
The code in the video had players[0] and player[0] in CoinGame constructor instead of player[0] and player[1]. The code is correct in the hand out.
Also the code ran correctly in video, so you may have edited it. Just an observation.
As always awesome video.
Sorry about that. Yes I do these tutorials out of my head so on occasion a little error slips in.
the string winningFlip in class CoinGame doesn’t change, so I moved line 5 inside startGame method.
Is that correct?
Sorry about that error
I just completed this. I tried to write the codes on my own using the SD/CD before looking at yours. It was fun! <3
Niki
That is the perfect way to use this tutorial. I’m glad you enjoyed it 🙂
Hello Derek,
thank you so much for the effort of putting those videos together! I’m in the process of learning Java right now and your tutorials are making it so much easier to digest. Awesome work!
Marc
Hello Marc, I’m very happy that they are helping 🙂 Many more videos are coming.
Hello Mr. Banas,
I have a question to you which I was asked in an informal interview by a professor from NASA, he asked me, “can you write a compiler that takes your C# code and compiles it” (I suppose he meant without .Net framework or JVM and JDK?) . I was clueless and so much ambressed. I am just a university student not a great developer. I want to know is it possible that I can write my own compiler for my java or C# code? if yes please recommend any books for guidance. Humble thanks
Raj
Hello Raj,
Yes you could, but it wouldn’t be that easy. You’d just convert the C# code into the native assembly language of the host computer that runs it. Engineering a Compiler is a pretty good book on compilers.