• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design Patterns - What Did You Use?

 
Sean Keane
Ranch Hand
Posts: 588
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am reading over a few peoples comments about their solutions and many outline the design patterns these used. So I was wondering what patterns people used, what area they used them in, and for what purpose?

For example Ken Kerbs outlines quite a few in the comments about his solution here :

* Pattern: Identity Map
* References: MartinFowler.com, Wikipedia, Ken Kerbs notes on his solution
* Area: Data class.
* Purpose: My Data class provides an "Identity Map" (cache) of Contractors and helper methods for the Contractor class to read and write the data.

I intend to compile a list myself and update here. But if others would like to update also with patterns they used I think this would be beneficial to many of us

Here's the template I used for the example above - so people can copy and paste, and update with their own information.



Cheers, Sean.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used following design patterns:
- singleton
- dao factory
- mvc
- transfer object

Maybe I used a few others without knowing it
 
Sean Keane
Ranch Hand
Posts: 588
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roel. I know it's probably a "big ask" of peoples time, but would have any more context on the use of these patterns as I showed in my example. Mainly what area you used them in and what the purpose or motivation behind using them was? It is this additional information that I think will help others when thinking about their design - i.e. context on use of the pattern.

Even if people didn't have time to follow my template and just dumped the info in using their own format. I was thinking I could collate it all and reformat. Then maybe it would be a useful long term resource, and something worthy of a sticky post (or added to the reading materials) ?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Purpose or motivation for using a design pattern is for everybody the same in my opinion (and it's the reason why you have design patterns) and it's in the definition of garbage collection: a design pattern is a general reusable solution to a commonly occurring problem in software design. So you face a problem, don't want to reinvent the wheel, so you use a design pattern.

And I won't give the areas where I used the design patterns, because I think that's not the intention. People may use a design pattern because the code needs it and not because 25 people who made the assignment used it, so I better use it too.
 
Sean Keane
Ranch Hand
Posts: 588
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, a design pattern is general solution to a particular problem. So in general terms everyone will be applying the design pattern because they see an instance of the particular problem.

However, not everyone starting the Developer certification would be familiar with design patterns, or certain category of patterns. That is where the context is useful. It's all well and good reading up on a pattern. But particular instances where people applied the pattern do have benefit as that provide others with concrete examples of where they applied the pattern. So it helps people who are new to the pattern identify situations where a pattern could be useful within the context of something they are actually working on, as opposed to some theoretical example in a book.

I understand the thought of not telling people the areas one used a design pattern as people may blindly copy it. That's one way of looking at it. Another way is the way I described in the previous paragraph. Yes some people may blindly copy, but I think there's a greater benefit in providing context on where patterns were used as it helps people who want to learn.

Even if they did blindly copy, they are still learning, simply be the mere fact that they are using the pattern. Think about it - if I read that someone used the Factory Method pattern and I had never heard of it before. Even if I blindly copied the use of this. I would first have to read up on it to understand it, then I would have to implement it in order to use it. That's all learning

Think about it this way - if the GOF never wrote the book, with patterns and examples, would we be using them now? Everything is derivative
 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sean Keane wrote:It's all well and good reading up on a pattern. But particular instances where people applied the pattern do have benefit as that provide others with concrete examples of where they applied the pattern. So it helps people who are new to the pattern identify situations where a pattern could be useful within the context of something they are actually working on, as opposed to some theoretical example in a book.
...
Everything is derivative

I'm not sure it's a good idea, nor that it's in the spirit of the thing, for one certification candidate's design to be derivative of another's.
 
Sean Keane
Ranch Hand
Posts: 588
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Byron wrote:I'm not sure it's a good idea, nor that it's in the spirit of the thing, for one certification candidate's design to be derivative of another's.


So you didn't read any books about the assignment? You didn't read any posts on here? You didn't read any tips from people who successfully passed? There's not many creations in life that are not a derivative of some other...

Anything that people repeat is a pattern. Just because some are officially "design patterns" doesn't make them special. For example some people synchronize all their data methods, some don't. Some people implement all operations in the GUI, some don't.

I found Ken Kerbs post particularly interesting and useful as he mentioned design patterns I had not come across before. The fact that he gave some context on them i.e. where he used them, helped me understand how they applied to this assignment. I don't see anything wrong with that - it's not as if he gave us a solution.

Like I said before I still needed to read up on the pattern. I still needed to write some code to implement it. All learning - surely the whole point of a cert
 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sean Keane wrote:
David Byron wrote:I'm not sure it's a good idea, nor that it's in the spirit of the thing, for one certification candidate's design to be derivative of another's.
So you didn't read any books about the assignment? You didn't read any posts on here? You didn't read any tips from people who successfully passed?
Your rebuttal misses the point.

What's the heart of the work that the candidate ought to be expected to achieve on his own? A stunt of coding or a proper design expressed through implementation?
 
Sean Keane
Ranch Hand
Posts: 588
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Byron wrote:
Sean Keane wrote:
David Byron wrote:I'm not sure it's a good idea, nor that it's in the spirit of the thing, for one certification candidate's design to be derivative of another's.
So you didn't read any books about the assignment? You didn't read any posts on here? You didn't read any tips from people who successfully passed?
Your rebuttal misses the point.

What's the heart of the work that the candidate ought to be expected to achieve on his own? A stunt of coding or a proper design expressed through implementation?


Do you think Ken Kerbs' notes are against the spirit of the certification?
 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sean Keane wrote:Do you think Ken Kerbs' notes are against the spirit of the certification?

It would be appropriate to sticky that thread and rename it "Just do this if you want to pass." ;)
 
Sean Keane
Ranch Hand
Posts: 588
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with your convincing argument. It would then be appropriate to close down the entire forum, ban all books, and anything else that relates to this assignment.


 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sean Keane wrote:I agree with your convincing argument. It would then be appropriate to close down the entire forum, ban all books, and anything else that relates to this assignment.
Is it your programming experience that predisposes you to binary thinking in analog circumstances, or the converse?

Clearly, it would be wrong to post the code of one's assignment. Stretching from this to the hyperbolic extreme you mention is a continuum. Along that continuum fall various degrees of extensiveness and intensiveness with respect to description of a solution. Some of these, toward one end of the continuum, are clearly wrong; others, toward the other, are clearly inoffensive.

Toward the middle things get fuzzy, and what we're discussing is where one might draw the line in that area of uncertainty.

Given the fact that this is the nature of the domain we're discussing, your tendency to see precisely two possible positions (namely, yours or an intolerable and absurd extreme born in your imagination and then ascribed to your discussant) is perhaps not as helpful as an intelligent discussion might be.

For my part, it seems to me that a complete and deep description of one's source code would be just as impermissible as posting one's source code. The questions, then, are "What's too complete?" and "What's too deep?" You feel that what Krebs posted is perfectly fine; I feel that it approaches a border.

Where I come from, disagreements in judgment such as the one described are neither unusual nor surprising. You needn't try so hard to be "right".
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am I wrong, or this discussion is not being friendly as it could be?

Champions, let's try to continue this discussion smoothly... the spirit of this forum is for us to be as friendly and helpful as possible. Now, how about a hug?
 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Sean Keane
Ranch Hand
Posts: 588
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct and right everyone . Relax folks. It's just a certification at the end of the day - it's not the key to the holy grail.

David, firstly I hope I have not caused offence and appeared unfriendly - this is just healthy debate to me . Apologies if I did though!

Now. I think you may have misinterpreted me explaining my thoughts behind why I think sharing information on what design patterns people used is OK and a good idea as me trying to be "right". It makes no odds to me whether people think I am right - I'll still approach this assignment in the same way.

As you mention it is quite easy to define both ends of the scale and the middle is fuzzy. Everyone will have their view point on what is right and wrong in that fuzzy middle area. There's no authoritarian figure who is right\wrong - we all have equally valid opinions and our own reasoning behind them.

I've given my thoughts behind why I think sharing this type of information is OK and of benefit overall. But let me summarise. I'm approaching this assignment not as something that I want to get a perfect score in or a perfect solution. I'm using it as learning exercise. So reading Ken Kerbs post was beneficial to me because I read about design patterns I had not come across before - I may decide to use them, I may not use them. But Kens post caused me to read up on them, play around with them in code, etc. Also, from Kens information I was able to relate the new pattern to something I am familiar with - this context made it easier to understand a practical usage of it. So therein lies the benefit as I see it.

As for whether sharing such information crosses the border of what is in the spirit of the assignment. I see this type of information as no different to hundreds of other posts on here where people share information about common techniques used in design and implementation. This is exactly what design patterns are - commonly used techniques. Some just happen to have a fancy name .

Correct me if I am wrong here but you think sharing such information crosses the line. Which is fine. But I don't quite see your reasoning behind it - why this type of information is not OK to share, whereas hundreds of other posts on here, and books, etc. are OK to share? How people designed their data class, or implemented their user interface, etc. these are all patterns - they just don't have a common fancy name.

I don't think we will agree on this subject - but I am genuinely interested in the reasoning behind your viewpoint. I may even think twice about information I share going forward
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will make a last contribution to this topic.

In my story about this assignment I also have mentioned some things I did (or did not). All these things are on a high-level, I gave in that post no detail at all. When I posted this story I got a lot of questions (mainly through PM) to give more detailed information about how I handled different situations, just because I passed the certification with a perfect score and people think: if I do the same I'll pass too (with a perfect score).

When I answer questions of other people I always try to help them and give them valuable information. These answers are of course based on my own experiences with the assignment and with new experiences I have gathered in my daily job. I always try to give answers, but to give as few details about my own implementation as possible. If I post some code snippets, I'll try to explain the concept based on code which has nothing to do with the assignment. And of course you can't hide all details of your implementation (everybody knows I used a singleton for my Data class with all methods marked as synchronized by now).

Just like Andrew's book I try to give concepts or another view on things which you can apply on your own assignment (if you see the benefits of it). The book of Andrew Monkhouse is also about showing you concepts you might need in your assignment, but not to copy/paste the whole source and adjust to rooms or contractors (instead of dvds) and submit the assignment. (note: if you copy/paste the solution of Andrew's book you'll fail automatically, because he deliberately violated one of the must requirements, just to prevent copy/pasting)

So this forum is about giving advice, discussing approaches, suggesting certain concepts and alternatives,... not about providing the necessary information to be able to make an exact copy of someone's solution. That's why I don't have a problem with sharing which design patterns I used, but not sharing the area I used them. If you google the name of a design pattern, you'll get tons of information on the net to broaden your knowledge and you'll have to make the decision if it could be useful in your assignment.
 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:That's why I don't have a problem with sharing which design patterns I used, but not sharing the area I used them. If you google the name of a design pattern, you'll get tons of information on the net to broaden your knowledge and you'll have to make the decision if it could be useful in your assignment.

I'll associate myself with Roel's remarks here. I'm strongly in favor of cultivating a helpful community. I dislike the idea of spelling out implementation details (e.g., too much info about app architecture from a given solution) chiefly for the reasons he mentions.
 
Sean Keane
Ranch Hand
Posts: 588
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Morning folks! I think we are all in agreement that in a broad sense advice should be given without giving people the actual solution. But I think we'll have to agree to disagree on whether it is suitable to provide the level of information available in Ken Kerbs post on design patterns.

I think it's acceptable, and beneficial in a community sense as it gives people greater context on a design patterns usage and helps them learn. But you guys reckon it's giving too much info. I see it as no different to telling people the general approach for your data class, or what components you used on your GUI etc - in each scenario you are describing your approach and more to the point providing the context.

Right, I must leave you fully certified guys at the bar , back to this assignment!!!
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sean Keane wrote:I think it's acceptable, and beneficial in a community sense as it gives people greater context on a design patterns usage and helps them learn.

There is a dedicated forum on the ranch about design patterns and data modeling.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic