Hello everyone,
I just fall on an article on design patterns. They said that if you want to become a good programmer, you must follow design patterns. But till now I have never follow these patterns. I don't even know how to use design patterns, they said that there are 23 in total but how to use them and where to use design pattern? Please take the case of a chat application, for me to understand it well.

Thanks a advance.

IMHO design patterns are a great aid to good design. Why re-invent the wheel? Those patterns distil huge amounts of experience into templates that you can apply quite easily. However, I disagree that you "must" follow them, even less follow them blindly. You need to read, and understand them, then see how (it at all) they fit your current requirement, and adapt/simplify/modify them as necessary.
This http://www.javacamp.org/designPattern/ is a v good source. And if you want something to read on a ling journey, this http://www.patterndepot.com/put/8/JavaPatterns.htm is pretty wordy, but useful.

Yes- you do need to use good design to become a good programmer. However, don't let that article discourage you. I think you said you just started programming - a chat application is not something most people who just started programming would have much of a chance at completing successfully. Anyway, there are so many design techniques, it would be almost impossible to explain them in a post. Perhaps read about some of the design techniques mentioned, and ask some questions in this thread? Some of the important ones in Object oriented programming are Encapsulation, Inheritance, and Polymorphism. Of course, the most important thing is that similar data should be grouped together in classes, and methods should be used to manipulate the data in the class.

Yes ... I have already read these links before posting. For example in my chat application, which design pattern I must use(if any), just an example please. Because I have read some of the design patterns and I am asking myself "Where can I use these things?". I want to make my application more professional.

Thanks for the answer !!

I have completed the chat section. The chat section works perfectly, with hard work and with your help(thanks a lot). Now, I want to integrate FTP in it and also encryption of message.. I am coding the FTP separately first, to understand the concept, then I will integrate it in the chat and finally I will work on the encryption part.

... I am asking myself "Where can I use these things?". I want to make my application more professional.

Good for you. I'd start with MVC (or, inn this case M, (V+C)), but you should also look at Observer. For example when your GUI button is pressed to start the Server, you could (should) use the Observer pattern to allow the GUI to be informed when users connect to the server, rather than hard-code references to the GUI in the server. That way, if you ever decided (for example) to do a version where the UI ran on a web browser, or a remote admin machine, you wouldn't need to change the server code.
But don't get too hung up on this. You have plenty of time to start to learn about the most common ones.

I have completed the chat section. The chat section works perfectly

:-)

Its hard to point out any design flaws without seeing your application. If you want to post what you've got again, I'll read through it tomorrow (5 a.m. here, going to sleep). But you definitely do not have to apply any specific design pattern in order to produce a well designed application. And if you follow the basic principles of OOP, including the ones I posted in this thread, chances are that your design will be a good one.

Also, to add to what James was saying, I was reading this link earlier, it has a simple example that contains the Observer pattern for MVC. http://leepoint.net/notes-java/GUI/structure/40mvc.html

For the chat section ... I will post the code later on. I don't want other students to copy my code. But for the FTP, Encryption I can, because lecturers will marked only the chat section, which I have already completed, I want to add "extras" for me to score maximum marks and for self satisfaction. And if I got time, I will try to implement database also.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.