This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Improvements to Chat Program? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Improvements to Chat Program?" Watch "Improvements to Chat Program?" New topic
Author

Improvements to Chat Program?

James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

I have the source code to my Java Chat program on my blog. If anyone wants to download the txt files and look over them that would be great! Please reply here with any suggestions to make the code better. I think this was written with Java 1.5 so any improvements to Java have not been added.

http://jameshambrick.com/project/java-chat-program-2/

Also comments on my blog to help others that do not frequent this site would help too.

Thanks!


Visit my blog! http://jameshambrick.com
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7032
    
  16

James Hambrick wrote:I have the source code to my Java Chat program on my blog. If anyone wants to download the txt files and look over them that would be great! Please reply here with any suggestions to make the code better. I think this was written with Java 1.5 so any improvements to Java have not been added.

Any suggestions you get here are more likely to do with design improvements that specific release features.

But, from the top of my head (and by a cursory glance of your "client"), I can see a couple:
1. Your Client includes GUI logic, which is almost always a bad idea, because the problem that your program was written to solve is "chatting". How it's displayed is an entirely different issue; so it's usually best to keep the two completely separate.
2. I hate massive try...catch blocks. If you have logic that throws a checked Exception (or one that you're particularly interested in), put it in a well-named method that throws the same Exception, and call that method from your try...catch block. Modularity.

Like I say, just a cursory glance. We're volunteers here...

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Improvements to Chat Program?
 
Similar Threads
Running A Basic Program On The Web
JSP/Servlets/Chat??
Creating a Java chat server using sockets
communication problem in chat application.....Please help!!
Java Chat Program.