• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

how to improve my program code ?

 
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, good day, can anyone give me some ideas how to i improve my program, should i have few more classes rather than just keep all my code in one class ? thanks in advance for viewing and answering



[Please type "&lt;td>" instead of "<td>", -- the latter breaks the post ]
[ November 28, 2004: Message edited by: Mapraputa Is ]
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you should definitely break it into more classes or into more methods.

A good starting point might be to go through a list of code smells and think whether some of those are present in your code (and then fix them, of course).
[ November 28, 2004: Message edited by: Lasse Koskela ]
 
Ranch Hand
Posts: 872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would basically say the same as the other dude; break up methods into smaller ones.

The code between the case statements basically do the same thing, so make them into static method that returns new NewCompanyFrm object, you case statements will look like this.

case 2:
{
System.out.println("choose 2");
int[] alist = [1,2,4,5,7,8,10,11,13,14,16] //however arrays are implemented
arr.add(funcNewCompanyform(alist);
}break;

You code seems very complicated, have you looked for a better way of doing this. Could PHP or JSP help you; the mixing of HTML and source code makes changing HTML a pain. If you must use Java this way, maybe there are simple librarys on Internet that could hide the complication of ODBC database access to simplify the code for you.
 
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic