wood burning stoves*
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 Spring in Action this week in the Spring 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: 8008
    
  22

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?
Articles by Winston can be found here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Improvements to Chat Program?