IITDU Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Design pattern Assignment - fly weight pattern

3 posters

Go down

Design pattern Assignment - fly weight pattern Empty Design pattern Assignment - fly weight pattern

Post by BIT0122-Amit Sun Apr 10, 2011 9:55 pm

Course code: SE 506
Course name: Design Pattern

For those who were in class,today we were taught fly weight pattern, and we were given an assignment on it.
the assignment has two parts.
One is the part where no pattern is used.
the other part is where fly weight pattern is used.

We have to submit it on Saturday.

For those who were not present in class, please ask your classmates to explain the pattern to you. I don't know how to describe the problem that was given. Anyone who can explain, is welcome.
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

Design pattern Assignment - fly weight pattern Empty Re: Design pattern Assignment - fly weight pattern

Post by BIT0108-mostafa Fri Apr 15, 2011 1:27 am

It will be very kind if someone who attends the class please elaborate the problem.
BIT0108-mostafa
BIT0108-mostafa
Release Candidate
Release Candidate

Course(s) :
  • BIT

Blood Group : O+
Posts : 118
Points : 184

Back to top Go down

Design pattern Assignment - fly weight pattern Empty Re: Design pattern Assignment - fly weight pattern

Post by BIT0122-Amit Fri Apr 15, 2011 1:32 am

here I am giving my best shot:

In flyweight pattern, memory optimization is achieved by using less number of instances, which are used more times.

So, what instances are made less, but used many times?

Actually, we put common properties in those less number of instances, which are used in other individual instances.

For example, in the presentation, there is a soldier object. Now, a set of soldiers can have many common properties, and many individual properties. If we make the soldiers in the regular way, say, n times, then memory used will be

n*(common properties+individual properties).

Now, in fly weight pattern, there are 3 classes. Soldier, which contains the individual properties that can not be shared. SoldierDetails, which contains individual properties, and can be shared. And finally, soldier factory, which provides the soldiers the soldier details.

It should be mentioned that Singleton is used in SoldierDetails class to ensure that the same details instance is used in each soldier instance.

so, the memory size will be:

n*(individual properties)+size of one common shared properties instance.
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

Design pattern Assignment - fly weight pattern Empty Re: Design pattern Assignment - fly weight pattern

Post by BIT0108-mostafa Fri Apr 15, 2011 3:22 am

May be i was unable to specify my specifications clearly.
I was asking for the problem scenario which we should implement rather than the elaboration of the pattern.
BIT0108-mostafa
BIT0108-mostafa
Release Candidate
Release Candidate

Course(s) :
  • BIT

Blood Group : O+
Posts : 118
Points : 184

Back to top Go down

Design pattern Assignment - fly weight pattern Empty Re: Design pattern Assignment - fly weight pattern

Post by BIT0120-ধ্রুব Fri Apr 15, 2011 3:26 am

[You must be registered and logged in to see this link.]

this is the link of source code of the problem given by sir. It may be helpful to understand the problem and the solution (!!!!) as well....
BIT0120-ধ্রুব
BIT0120-ধ্রুব
Release Candidate
Release Candidate

Course(s) :
  • BIT

Blood Group : O+
Posts : 191
Points : 833

http://dhrubo-nisshongokothopokothon.blogspot.com/

Back to top Go down

Design pattern Assignment - fly weight pattern Empty Re: Design pattern Assignment - fly weight pattern

Post by BIT0122-Amit Fri Apr 15, 2011 3:57 am

I was asking for the problem scenario which we should implement rather than the elaboration of the pattern.

I explained the problem scenario. It is the soldier, soldierfactory thingy.
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

Design pattern Assignment - fly weight pattern Empty Re: Design pattern Assignment - fly weight pattern

Post by BIT0120-ধ্রুব Sat Apr 16, 2011 12:36 am

BTW, will we need to submit the solution with two different type...??
I mean, with the flyweight pattern and with the regular procedure....
I heard something like this in the class. But i am not sure about this..
BIT0120-ধ্রুব
BIT0120-ধ্রুব
Release Candidate
Release Candidate

Course(s) :
  • BIT

Blood Group : O+
Posts : 191
Points : 833

http://dhrubo-nisshongokothopokothon.blogspot.com/

Back to top Go down

Design pattern Assignment - fly weight pattern Empty Re: Design pattern Assignment - fly weight pattern

Post by BIT0122-Amit Sat Apr 16, 2011 12:40 am

yup. Both of them.
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

Design pattern Assignment - fly weight pattern Empty Re: Design pattern Assignment - fly weight pattern

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum