Design pattern Assignment - fly weight pattern
3 posters
IITDU Forum :: Academics (BIT) :: Semester 5 :: SE 506
Page 1 of 1
Design pattern Assignment - fly weight pattern
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.
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.
Re: Design pattern Assignment - fly weight pattern
It will be very kind if someone who attends the class please elaborate the problem.
BIT0108-mostafa- Release Candidate
- Course(s) :
- BIT
Blood Group : O+
Posts : 118
Points : 184
Re: Design pattern Assignment - fly weight pattern
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.
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.
Re: Design pattern Assignment - fly weight pattern
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.
I was asking for the problem scenario which we should implement rather than the elaboration of the pattern.
BIT0108-mostafa- Release Candidate
- Course(s) :
- BIT
Blood Group : O+
Posts : 118
Points : 184
Re: Design pattern Assignment - fly weight pattern
[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....
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....
Re: Design pattern Assignment - fly weight pattern
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.
Re: Design pattern Assignment - fly weight pattern
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..
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..
Similar topics
» Design Pattern: Assignment Shapes
» Design Pattern study material: Composite Pattern
» Mediator Design pattern
» My TODO List : Design Pattern
» Shapes Design using Composite pattern
» Design Pattern study material: Composite Pattern
» Mediator Design pattern
» My TODO List : Design Pattern
» Shapes Design using Composite pattern
IITDU Forum :: Academics (BIT) :: Semester 5 :: SE 506
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Tue Sep 29, 2015 2:45 pm by Sophiawood
» Cisco EHWIC SFP/GE WAN Card
Mon Sep 07, 2015 11:08 am by Sophiawood
» Huawei S1700-28GFR-4P-AC Price
Thu Jun 25, 2015 2:31 pm by Sophiawood
» teach yourself C++ / Herbert Schildt Solutions
Wed Jun 03, 2015 1:52 pm by Abdullah Al Noman
» teach yourself c by herbert schildt pdf
Wed May 13, 2015 11:01 pm by Raquib Ridwan
» ASA 5506X With Firepower ASA5506-K9
Fri Apr 10, 2015 4:31 pm by Sophiawood
» New Trends in Deal Business
Tue Feb 03, 2015 9:38 pm by nersoa
» PoE Power Allocation for WS-C2960S-24PS-L
Wed Nov 05, 2014 11:12 am by Sophiawood
» How to cure back pain
Fri Oct 31, 2014 7:15 pm by Bergen Guildford