File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Applet Coding Conventions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet Coding Conventions" Watch "Applet Coding Conventions" New topic
Author

Applet Coding Conventions

Sachin Adat
Ranch Hand

Joined: Sep 03, 2007
Posts: 213
Are there any special coding conventions for Applets.
Like I read somewhere, that you should not put your applets in packages, if its not really needed.
But its the opposite in case of other Java Classes.
Also, some guidelines (do's and dont's) for applets will be very helpful.


SCJP 6
How To Ask Questions On Java Ranch - How To Answer Questions On Java Ranch
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41823
    
  63
I'm not aware of any special convention. Where did you read this one? I would question it.


Ping & DNS - my free Android networking tools app
Sachin Adat
Ranch Hand

Joined: Sep 03, 2007
Posts: 213
Ulf Dittmer wrote:I'm not aware of any special convention. Where did you read this one? I would question it.

So I write applets, just as I write my java classes......?
I got it from Reduce applet's loading time
I really need to get some guidelines on how to write applets........I am going through the sun site.
But I feel, I need more. And the searches that I get are not helping me.
Currently I am working on understanding an applet which is more than 2000 lines(not written by me) and I am going to have to maintain it.
I just want to make sure that it is written properly...........
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41823
    
  63
That page is terrible; I'd advise to ignore it. None of those hints do much in practice, and they make the code worse. Just make sure the applet is in a jar file, and you should be fine. (There isn't much you can do if the applet is big, or uses big libraries, and users are on a dial-up line. But otherwise, don't worry about it.)

If you want to make the code maintainable, start by refactoring any class that's longer than a few hundred lines of code at the most.
Sachin Adat
Ranch Hand

Joined: Sep 03, 2007
Posts: 213
Thanks for the reply........
Ulf Dittmer wrote:If you want to make the code maintainable, start by refactoring any class that's longer than a few hundred lines of code at the most.
There is only one class with 12 inner classes(all extending threads except one that implements runnable) and 24 methods.
I've got to understand it first............... and then maintain it
And I am just a beginner at applets...........
Actually, the applet is not used for animation at all. It is just used for doing io and logging operations behind the scenes for a flex based ui.
I don't know whether it is the right way to do it or a correct use of applets............
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet Coding Conventions