Good problem domain for introduction to OO project? - java

I'm working with someone who's looking to get back into programming after several years of IT support work. They know all the iterative programming basics and have used them frequently, but their only object-oriented programming experience was in college. The goal is to come up with a decent-sized project that is good for illustrating and practicing OO concepts. Has anyone ever used or thought of a good problem domain for an introduction to OO? I'm looking for a domain where concepts such as inheritance, abstraction and polymorphism really make sense and provide an advantage when modeling with the classes.
Of course, I did some googling and found the popular ATM and Address Book OO examples. They're both pretty good, but ATM is a little more complex than what I'm looking for. Address Book may be decent, but I think it might not be complex enough, or a clear enough domain for modeling objects. The goal is for the project to take a decent amount of effort to complete, not something that can be completely done in an afternoon or two.
As for implementation specifics, the project will be implemented as a Java console app with a minimal UI. Learning the OO concepts and how to implement them in Java is the primary purpose of this app.

How about a text based adventure game?

I like casino game simulation. Simulation is one of the application domains that lead to the development of OO programming. Casino games are relatively simple but with some sophistication.
You can look at http://homepage.mac.com/s_lott/books/oodesign.html.

Along the same lines as address book, a general catalog (cds, books, dvd, equipment & so on). The idea here, you have a base item that is extended by all the other types (inheritance) and each one can implement a specific interface for display and other purposes (polymorphism).

When I've taught other people how to understand OO-principles, I've asked them to relate to OO-programming as if they were building a house. A house has everything you need.

Related

software analysis .... Start with UML or Design Patterns? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am a java programmer with 2 years experience, I really like programming, especially OO programming, and if I have a project, I start with programming directly, without any system analysis operations, so my code is not sorted as it should be, I want to learn how to write and design a good code, should I start learning UML or I can go directly through Design patterns ? and what are the best books for learning UML and Design Patterns.
Thanks a lot for your time
Start with a broad-brush design, where you identify the major parts of your solution. You can use UML for that, but it's not mandatory.
Then, start writing tests, or executable specifications, and evolve the code to meet those tests. Use your broad-brush design as a guide, and also the tests. Practice test-driven development. Solicit feedback from your stakeholders. Iterate. Iterate. Iterate.
(Of course, that depends a lot on the type of application that you do, I'm assuming business-like, non-safety-critical software).
As for books, look at "Domain Driven Design" and "Growing Object Oriented Software, Guided by Tests".
Oh, and never start with design patterns...
UML is a means to an end, and by no means the only one. Try it and see if you like it, personally I'm not too fond of it. You need to discover yourself how you want to think about and design your applications. Personally I like drawing boxes on a whiteboard.
Design patterns can be useful but they describe solutions to more specific problems. A pitfall here is that people that start off with design patterns try to apply them everywhere. They try to match a design pattern with a problem, but it should be other way around. UML and Design Patterns are in no way mutually exclusive and they don't (necessarily) serve the same purpose.
As far as design patterns are concerned, I found Head First Design Patterns to be a nice and easy to read book, although this is terribly subjective as I know a lot of people who really hate the writing style of the Head First books.
UML is a way to represent a model, it's not a replacement for the model. The model can be expressed in UML, but not only in UML.
Design patterns help creating the suitable model and avoiding common mistakes. Personally, I found books by Martin Fowler and Eric Evans very useful, but I'm sure there are many other good writers as well.
There's no recipe for learning how to design code, it's about experience.
well, after 15+ years of assembly/basic/pascal/java/c/c++/C# and another gazillion languages sometimes my code is just not sorted as it should (or could be), still I'm well payed and generally considered a good programmer.
Too many reasons behind that, tight release dates, too fast evolving tech, dumb client requirements, monstrous frameworks designed only thinking about extendability (it's this even an English word) and not focusing on usabiliy.
When I start a new project, the first thing I do is have a coffee.
Then I contact the customer (or whoever will use the application) and try to get a grasp on what they really need. Understanding what the client needs is the real goal (after getting paid of course ^^)
After this, I took pencil and paper and draw, not following any standard. Boxes, circles, arrows, with notes, some kind of artistic brainstorming.
Design patterns... best way to use them is avoid them. Too often they don't match real life problems, but programmers all over the world are abusing them everywhere, yes, mainstreaming leads to that. But if you feel the absolute reason to use them, start with the GoF beast (Design Patterns: Elements of Reusable Object-Oriented Software: Erich Gamma, Richard Helm, Ralph Johnson e John Vlissides).
2 years is just a small amount of time. Designing good code requires a bit more time (and of course experimenting with different languages)
The best book available for design patterns is the book 'Design Patterns: Elements of Reusable Object-Oriented Software' By the Gang of Four. The latest version of this book also includes an UML book in the package. Together this will be a good start.
However, just implementing design patterns is wrong. When you want to learn to write and design good code, understanding when to use patterns (and when to develop your own!) is a must.

Component Oriented Software and Design

Recently my ad-visor asked me to see if I could build a simulation framework which can be used for implementing + testing some new distributed computation paradigms.
I looked into some open source frameworks - and found that there are quite a few simulation frameworks available and most of them are based on component oriented software design principles. I looked up this topic on the internet and found that this was sort of the thing in the late 90s and early 00s but has now kind of faded away from the high point. Does anyone has some good books to suggest on what exactly it is? Now having some exposure to Java - I also noticed that I might have already have used some of component oriented software concepts (e.x - I have created simple wysiwyg document editors using Swing's text apis, so I am aware of concepts such as - Views, StyleContext, StyleDocument etc. etc.) - though I explicitly didn't take notice of the techniques.
Any pointers to beginner books/tutorials will be greatly appreciated. I just want to create some small app to see if any of this at all makes any sense.
To build a flexible simulation framework you may want to look at a functional programming language, such as Scala, as by design it works better for this since you can then either design a DSL (Domain Specific Language) to help abstract out writing the simulators, so others can focus on their research instead.
For an example of someone wanting to use Scala for a simulator you can look at Howto design a clock driven multi-agent simulation.
For an interesting page with a .NET reference that compares OOP with Component Oriented programming you can look at this blog: http://www.elenkist.com/bushido_burrito/blog/?p=11.
Before you get too wrapped around a language or technology, design out what you want to do, how you want the user to interact with your framework, then decide on the best approach, rather than trying to pick an approach and forcing your solution to work within those constraints.

Reinforce skills in Java

This past semester I took intro to object oriented programming in java and next semester I will be taking computer science 2 with java which is basically learning about various algorithms and data structures implemented in java such as linked lists, binary trees, etc...
What are some ways that I can reinforce the knowledge I've learned in my intro to object oriented programming class while still preparing for next semester of algorithms and data structures.
There's a good website that helped me get into java which is called CodingBat. => It even contains an online compiler to check your solution against some testcases.
After being "done" with codingbat, I started on ProjectEuler - this one contains the real badass problems :D
I highly suggest checking out those pages.
Edit:
Those problems weren't related to the real-world problems I encountered until now. But they surely helped me thinking about code in a different and efficient way.
Coding issues now seem like puzzles to me. Which immensely motivates one towards a goal.
You can do some programming in java.
These are some interesting problems, so you can solve these problems in Java in order to improve both Java and Algorithm knowledge
Project Euler
TopCorder is another good place to start. Just go to algorithm section and launch topcorder arena. Moreover it has some nice tutorials about algorithms.
Good Luck
From easy => difficult:
learn/code linked list
learn/code graphs
learn/code about red black tree
I see you want to improve your OOP skills and not the problem solving skills. My best suggestion is below and in that order
General Responsibility Assignment Software Principles or GRASP
Practical API Design: Confessions of a Java Framework Architect

How to design Java application? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
What are the general guidelines and best practices to keep in mind while designing Java application [Simple console apps to J2EE apps]?.
Hi
I recently completed Java programming tutorial from Sun
and practised core java (I have previous programming experience).
Now I understand the basics of Inheritance, Abstraction , Polymorphism,Encapsulation
Now i am writing Java code without much difficulty, but am not sure of application design.
This is my main problem: "DESIGNING" the application.
Say if i have given a task to create an application in Java,
What should I start up with? How to think about?
Any formal/informal guidelines I should follow while developing class hierarchies? I am really confused (abstract class or interface or sub class..?).
Should I start by model everything, before writing code?
It would be very useful for people like me to have a SET OF GENERAL GUIDELINES/BEST PRACTICES, which we can follow while start developing a new java application.
Please provide me some guidelines/thoughts/books/resources/tools I should read or Use
Thanks in advance
Scott
It is difficult to give really general advice as there are so many different Java apps on different domains. However, one absolutely recommended book is Domain Driven Design by Eric Evans. See also Wikipedia for a short intro on it.
General advice:
don't try to design everything up front - do a reasonably good design which enables you to start coding, then refactor as your understanding of the problem domain and the implementation deepens
try to divide difficult problems into smaller parts/steps/modules which you can tackle one by one
try to think in terms of objects with well defined responsibilities, which (more or less) model the problem domain and cooperate to solve a problem / handle a task
becoming good at design requires practice, first and foremost; don't be afraid to make mistakes. However, when you do, analyze them and learn from them as much as you can
learn design patterns, but don't be overzealous - use them only when they really solve a problem and make your code cleaner
In my opinion it all boils down to meeting the below
easy to understand
easy to maintain and evolve
multiple developers able to
contribute to the project (mostly in
parallel)
To achieve the above there are certain guidelines and principles that are suggested by experts based on experience which are
Follow layered architecture
Follow the SOLID principles within and across layers. All the design patterns are one way or the other help achieve these principles only. SRP: Single Responsibility Principle, OCP: Open Closed Principle, LSP: Liskov Substitution Principle, ISP: Interface Segregation Principle, DIP: Dependency Inversion Principle
DRY and KISS principles
These guidelines and principles are independent of any programming paradigm or language. However, OOP languages help implement these easier.
There are various paradigms (very often 3 letters acronyms) :
DDD : Domain Driven Design
SDD : Serviice Driven Design
MDA : Model Driven Architecture (code and architecture is extracted from the UML model)
TDD : Test Driven Development (validation tests are implemented before the application)
With theses key-words, you'll find a lot of informations on the web.
In J2EE, I would say that the SDD is the most used (it is now very "normalized", even if I'm not sure it is the best solution) : service (software "intelligence") > domain (bean objects used for persistance) > DAO (persistance).
Now DDD is becoming more and more used : the conception is refocused on domain objects, which are taking the "software intelligence" layer.
I really advice you to take a look at GRASP principles, it gives you a good design basis skills.
Welcome to stack overflow.
If you are good with Java, read Head First Design Patterns.
and
Head First Object-Oriented analysis and design - er, may be in reverse order :)
Start by looking up UML Class diagrams that will get the ball rolling in the right direction, then take a look at Gang of Four design patterns. That is an excellent first step.
http://en.wikipedia.org/wiki/Class_diagram
http://en.wikipedia.org/wiki/Design_Patterns
Lastly, I would pour over good open source code like the Spring Framework
http://www.springsource.org/
I'd recommend emergent design with TDD.
I think there is nothing specific to Java design : if you already know about Object Design, you're ready to go !
Do not start coding immediately without having any design. But this does not mean that you should design all before coding. Because from my previous experiences, I could not have any design which does not need corrections. Especially if you are new in a programming language your design will change according to the features of the language you are using and the libraries available. My advice is to have a general design which is based on the most important aspects of object oriented design such as inheritance, polymorphism, encapsulation etc. Starting from this general design and the needs you encounter while programming, revise your design accordingly.
As much as you get experienced in the language, your first general design will fit in a much more efficient way to your program.
Although most of the people say that one object oriented design should be able to be written in any object oriented language, it is not that easy to have a very good generic design like that. To be more realistic, disregarding the language that is used for implementing a particular design is not a good way as far as I am concerned.
Well odds are what you'll be doing has already been done before - at least something similar. Luckily, there's lots of open-source stuff nowadays. So if you really have no idea, one thing you can do is download several open-source applications that do the same thing and study them. It should give you a good start.

Going from PHP to C/C++ & Java & beyond

I've been a LAMP developer for 5+ years. I have learned quite a bit on my own, but I feel like my "context" as a software developer is limited (ie. I can only create scripts & web applications). Ultimately I'd like to be able to create a range of applications from daemons to desktop apps. Additionally I'd like to learn more about the "internals" of programming (ie. PHP is a wrapper for c, perhaps I should learn more c?)
I'd like to know what resources & methods that have helped people further their knowledge of computer science / software creation. Unfortunately I don't think I'll be able to go back to school and get another degree :-P
If you want to jump in with both feet, there's MIT's Open Courseware. For example, here's the online version of the famous course "6.001 Structure and Interpretation of Computer Programs".
To take smaller steps, I'd suggest learning other programming languages that are complementary to PHP, like Python or Ruby. Maybe eventually Java. The more languages you learn, the easier it becomes to learn even more languages, or to deepen the knowledge you have of the languages you already know.
I would really recommend Stroustrup's excellent book to learn modern C++ :)
I don't recommend that you directly move to the MIT course ware and SICP. Start from some basics. Read the "C Programming Language" by Brian Kernighan and Dennis Ritchie. Write some C extensions to PHP. After you are comfortable with C move on to C++ (Read "The C++ Programming Language" by Bjarne Stroustrup) or Java (tons of documentation and tutorial are available at http://java.sun.com/). Note that the books you choose are important. While learning a new language, a book written by it's creator should be preferred, as it will show you the right idioms, which is very important. Then move on to learn about new paradigms, like functional programming. At this point I think SICP will be a good choice. Learn one or more functional languages - Lisp/Scheme, Clojure, Haskell etc.
Make it a point that you never stop learning!
Pick a language, then seek out resources for learning it.
The one thing I'd suggest is to treat C, C++ and Java as sibling languages. Don't think "If I start with C, I can proceed to C++ and then to Java" or similar. Each of them can and should be learned independently of the others.
Java is often said to be inspired by C++, which any C++ programmer can see is clear nonsense. It is inspired by the earliest versions of C++, the ones that had more in common with C. And likewise, C and C++ have little in common as well. Good C code is almost guaranteed to be horrible C++ code.
All three languages are worth learning, and all of them will probably teach you a lot about programming. So pick one, and buy a good book on it.
Have a look over at Stanford's online courses it is a great place to start programming in more complex languages.
the site has both java and c++ courses online and much more.
When i started to learn PHP i found this really good site http://tizag.com
It kept all the stuff i needed to learn basic.. When any complex programming was required i looked else where, However without tizag being my cheat sheet for web bassed languages i would have been lost;
My cheat sheet for C++ was http://cplusplus.com/doc/tutorial/
Its basic stuff, with very clear explination. However i do recomand you try coding the examples rather than just read over it.
Practice Makes Perfect (Speaking of Which gota beat Suzuka in GT5 Proluge in under 1:33:487)
Get a job as a starting C++ developer. A bit of fiddling around at home isn't going to do much good, except for getting your foot in the door at an interview. To get to that level, anything is good - Accelerated C++ being a good book, or The C++ Programming Language (quite hard to learn the basics from, but if you're proficient in other languages its doable).
Everyone here made great recommendations, here are my two cents to the lot. You can learn language internals, there is no dearth of them. There is so much to learn about them that you can go on for years. I suggest you read Art of Programming by Donald Knuth, it was a great experience for me and I don't know why it is not a standard textbook in our universities.
Programming is an art indeed and it's the only art I know.

Categories

Resources