Re: Inner classes use
From: perry anderson (perry_at_cplusplus.org)
Date: 05/29/04
- Next message: P.Hill: "Re: Size of primitive types?"
- Previous message: perry anderson: "Re: Java Server Socket & C++ Client Socket"
- In reply to: devu: "Inner classes use"
- Next in thread: Gawnsoft: "Re: Inner classes use"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 29 May 2004 12:17:47 -0300
inner classes where designed for a reason, simplicity of code is one. if
reducing class names in your global namespace is of importance to you go
right ahead. sounds to me like you are after reading up on some GoF...
give it a whirl, you'll know soon enough
- perry
devu wrote:
> Currently I'm working on a class that performs a batch process as per
> scheduling for all employees in a company. Being a batch process load
> is obviously a huge factor.
> The process first needs to calculate the eligibility of each employee
> before proceeding to the next stage. I need to cache some of the
> employee information if an employee is found eligible for later use in
> the next stage.
> One option could be a javabean style value object class with all
> required attributes and getter setter methods. However I would like to
> avoid the overhead of these method calls for say 3000 eligible
> employees. A lightweight object where I can access the attributes
> directly would help me
>
> I therefore propose an inner class....
>
> class Process {
>
> doEligibility () {
> EmpInfo a = new EmpInfo();
> a.attrib1 = //set it
> a.attrib2 = //set it
>
> //store in hashmap with empID as key
>
> }
>
> private Class EmpInfo { //INNER CLASS
> int attrib1;
> String attrib2;
> ....
> }
>
> doProcess {
>
> EmpInfo a = (EmpInfo) map.get("empID");
>
> //use the attributes directly
>
> }
> }
>
> Is this wrong/bad design ?? If so, what is a better way to achieve
> this ???
- Next message: P.Hill: "Re: Size of primitive types?"
- Previous message: perry anderson: "Re: Java Server Socket & C++ Client Socket"
- In reply to: devu: "Inner classes use"
- Next in thread: Gawnsoft: "Re: Inner classes use"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|