dcsimg
Should i use the bridge pattern for my problem ?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, March 31, 2005 05:47 AM

Hello I'm making a music mixer for mobile phones. For the canvas, i divided it up in tiles, to fill up with .png images if you want to place a sample in that specific tile. But if you have a phone with no colors and your screen is not big enough, the image is almost all black. So I want to create a different class, to only show a letter or a simple symbol if you can't handle the .png well. I read about the bridge pattern, where you encapsulate the implementation in an abstract class and seperate it from the base class with the abstractions. Should I use this pattern for my problem ? I have some doubt because I have multiple implementations (color vs non-color) but I don't have multiple abstractions (a tile to fill up with a symbo   More>>

Hello

I'm making a music mixer for mobile phones. For the canvas, i divided it up in tiles, to fill
up with .png images if you want to place a sample in that specific tile. But if you have a phone with no colors and your screen is not big enough, the image is almost all black. So I want to create a different class, to only show a letter or a simple symbol if you can't handle the .png well.

I read about the bridge pattern, where you encapsulate the implementation in an abstract class and seperate it from the base class with the abstractions. Should I use this pattern for my problem ? I have some doubt because I have multiple implementations (color vs non-color) but I don't have multiple abstractions (a tile to fill up with a symbol or picture).
Are there other patterns that are more suited for my problem ?

What about the implementation? Should I see the implementation as only producing the image or symbol, or should i see it as the whole canvas, with the tile system?
For example, now the tiling looks good on most of the targeted phones. But what if the next generation of mobile phones has a screen with very different dimensions. Wouldn't it be better to incorporate this also in the implementation ?

Thanks

   <<Less

Re: Should i use the bridge pattern for my problem ?

Posted By:   oli_nilavan  
Posted On:   Wednesday, April 6, 2005 05:49 PM




You can go for factory pattern. Create a factory called MusicFactory and it should have method called getMusicFactory , which should return either ColorPanel or NonColorPanel class while passing an colorType argument. But you should able to identiy whether the request is Color or NonColor , then you can able to initialize the appropriate class.







Or you can go for AbstractFactory pattern that create a common class called Music which has all the basic functionality of ColorPanel and NonColorPanel. And you can create a very specific class for ColorPanel and NonColorPanel, these class has to implements Music class.





For both the Pattern you have to identify the request first Color or NonColor.




regards
Oli Nilavan
About | Sitemap | Contact