Click here to Skip to main content
15,885,216 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
Questionrich text editor Pin
Danielos_s2330-Jan-13 10:03
Danielos_s2330-Jan-13 10:03 
AnswerRe: rich text editor Pin
José Amílcar Casimiro11-Feb-13 5:37
José Amílcar Casimiro11-Feb-13 5:37 
QuestionMVVM, EF and TDD tutorials Pin
cansino17-Jan-13 6:06
cansino17-Jan-13 6:06 
QuestionJava and C# operating on the same data in an ASP-based monitoring web application. Pin
vValkir17-Jan-13 0:18
vValkir17-Jan-13 0:18 
AnswerRe: Java and C# operating on the same data in an ASP-based monitoring web application. Pin
Jonathan C Dickinson17-Jan-13 3:05
Jonathan C Dickinson17-Jan-13 3:05 
Questionindesign cs6 trial - no toolbar Pin
Member 93448236-Jan-13 12:10
Member 93448236-Jan-13 12:10 
AnswerRe: indesign cs6 trial - no toolbar Pin
Pete O'Hanlon17-Jan-13 0:49
mvePete O'Hanlon17-Jan-13 0:49 
QuestionHow do you design this? : with a better example Pin
Eytukan30-Dec-12 17:57
Eytukan30-Dec-12 17:57 
There is a huge hybrid battle ship that sail, load cargo, carry ammunition, commandos, & sometimes go down the water like a submarine, and some time camouflager itself based on the surroundings. It does a lot of things, & equally has a lot of properties like, color, size, Housing capacity, firing capabilities. etc.


Now, on the ship, there's only one place where I can mount ammunition.

I have a set of ammunition. Anti-aircraft guns, fire shells, Launch missiles, etc etc. but all these are "mutually exclusive".

If I would like to mount the ship with Anti-aircraft guns, all other ammo go unusable. I can dynamically swap between available ammo.

C#
class BattleShip
{
  propert A,B ,.....Z;

  void MountAndFire(Ammo ammo_in)
  {

//if it's a gun,
	int ammo_in.Fire(numberofrounds:30);  //returns remaining ammo
   
// if it's a missle launcher:
        float  ammo_in.Fire(direction:120, distance:200); // return ammount of heat it generated on the ship

//cluster bomb
        int ammo_in.Fire(Numberofcluster:600, direction:120, Distance:200);// Returns something else

  }

};



How do you have a generic design to address this? I thought of having a Ammo Interface, and have a Fire() call,
But the parameter for the fire call differ for all the ammo. So I cant' say:

C#
interface IAmmo
{
  virtual int Fire();

}

Missile: IAmmo
{
 int  Fire()
{
} 
} 



The simple ordinary way is to check:
C#
void MountAndFire(object ammo_in)
  {


//if it's a gun,

        if(ammo_in.GetType==typeof(Antiaircraftgun)
	    {
            AntiAirCraftGun aag = (AntiAirCraftGun) ammo_in;

            aag.Fire(30);
        }

//Missle
        if(ammo_in.GetType==typeof(Missile)
	    {
            Missle missile = (Missile) ammo_in;

            missile.Fire(120,200);   
        }
	    
	
  }


You have a better idea for this?

Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.

AnswerRe: How do you design this? : with a better example Pin
Christian Graus30-Dec-12 18:25
protectorChristian Graus30-Dec-12 18:25 
GeneralRe: How do you design this? : with a better example Pin
Eytukan30-Dec-12 18:42
Eytukan30-Dec-12 18:42 
GeneralRe: How do you design this? : with a better example Pin
Christian Graus30-Dec-12 18:46
protectorChristian Graus30-Dec-12 18:46 
AnswerRe: How do you design this? : with a better example Pin
jschell31-Dec-12 9:10
jschell31-Dec-12 9:10 
AnswerRe: How do you design this? : with a better example Pin
Eddy Vluggen31-Dec-12 17:04
professionalEddy Vluggen31-Dec-12 17:04 
AnswerRe: How do you design this? : with a better example Pin
Keld Ølykke16-Jan-13 11:23
Keld Ølykke16-Jan-13 11:23 
QuestionHow to find the similarity between users in Twitter ? How to design a good and efficient idea? Pin
ldaneil27-Dec-12 7:26
ldaneil27-Dec-12 7:26 
AnswerRe: How to find the similarity between users in Twitter ? How to design a good and efficient idea? Pin
Pete O'Hanlon27-Dec-12 7:39
mvePete O'Hanlon27-Dec-12 7:39 
GeneralRe: How to find the similarity between users in Twitter ? How to design a good and efficient idea? Pin
ldaneil27-Dec-12 7:50
ldaneil27-Dec-12 7:50 
AnswerRe: How to find the similarity between users in Twitter ? How to design a good and efficient idea? Pin
jschell27-Dec-12 9:21
jschell27-Dec-12 9:21 
GeneralRe: How to find the similarity between users in Twitter ? How to design a good and efficient idea? Pin
ldaneil28-Dec-12 8:31
ldaneil28-Dec-12 8:31 
AnswerRe: How to find the similarity between users in Twitter ? How to design a good and efficient idea? Pin
April Fans27-Dec-12 15:43
April Fans27-Dec-12 15:43 
GeneralRe: How to find the similarity between users in Twitter ? How to design a good and efficient idea? Pin
ldaneil28-Dec-12 8:36
ldaneil28-Dec-12 8:36 
GeneralRe: How to find the similarity between users in Twitter ? How to design a good and efficient idea? Pin
April Fans3-Jan-13 16:46
April Fans3-Jan-13 16:46 
AnswerRe: How to find the similarity between users in Twitter ? How to design a good and efficient idea? Pin
Marc Koutzarov29-Aug-14 23:54
professionalMarc Koutzarov29-Aug-14 23:54 
QuestionClient - Server approach Pin
bugal21-Dec-12 0:33
bugal21-Dec-12 0:33 
AnswerRe: Client - Server approach Pin
jschell22-Dec-12 14:11
jschell22-Dec-12 14:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.