I have a class which is about 1000 line. So, I decide to break it down into small methods or classes. But, here is my problem, in the new method, I can not call some methods which are pre-defined for this class object. let me give you an example:
I have a Class which extends Agent class from"jade.core.Agent".
So I am capabale of using:
1)myAgent(which is a member variable)
2).send() method which let me to send a message from myAgent to another agent.
How can I define a method that let me to access this member variable and predefined methods of this class???
Do I need to define a method and then make a new object from class CoordinatorAgent? (But it means that all the code hat are in CoordinatorAgent will be executed again!!! which I dont want!!!)
Don't understand the question. Sorry. Why can't you cope with a 1000-line class?
Joined: Jul 06, 2009
actually I have several class and each of them contain about 1000 line. Well, it makes me confuse, some times Im lost in my code, there are many if s and for s which makes it hard to manipulate the code. So, I decide to cut some parts of my codes and then put it for example in some methods inside of my class. So, its more easy to read and change!
Sorry, let me explain again:
I have a class called A which extends jade.core.Agent class. I want to cut some part of codes from class A and put in a method called B. I make put method B at the end of class A.
e.g. In class A I have a piece of code like :
So I cut it and put it in method B. But its not accessible!! myAgent variable and .send method are from class Agent!
How can I have access to this variables and methods of class A?
Joined: Oct 13, 2005
If it ain't broke, don't fix it.
subject: how to split my code to make it more understandable and comfortable?