Help Community Login:




8 replies [Last post]
Uncle Freakin Joe's picture
Uncle Freakin Joe
Premium Member (Silver)I'm a Code Monkey!I use Internet ExplorerWindows User
Joined: 07/04/2009
Posts: 53
Drops: 95

Well, I've thought about it. I've thought about it. Then yesterday I started to do it.

I have a few DLL's started in C# with plans of porting over some other VB .NET code for a GUI. The plan is to do at least the very basic things that Orly's Mob Manager does, except make it Windows based. Why?

There are some pitfalls with what he's really wanting to do with what he has by sticking to a spreadsheet. There is a way to make a dynamic rendering manager, however it's not so readily integrated into anything with MS Office. Face it, there is more to code than VB script and the absence of being able to integrate bonafide .NET assemblies in.

So...I am starting with some simple things. I have some interfaces that are very generic. You basically have 2 things you buy in mobsters. You buy equipment, and you buy real estate. Everything else from that point is more or less presentation. So, the first thing I did was start to get some interfaces together.

I have those in C#. Here is an example of what I am thinking:

using System;
using System.Collections.Generic;
using System.Text;

//Written by Joseph I. Szweda
//July 6, 2009.
//This is a simple reusable interface for business objects
//for real estate within mobsters.

namespace MobsterRealEstate
{
interface IMobsterRealEstate
{

string strRealEstateName
{
get;
set;

}

int intRealEstateQuantity
{
get;
set;

}

int intBaseCost
{
get;
set;

}

int intIncome
{
get;
set;

}

int intCurrentPrice
{
get;
set;
}

decimal decReturnOnInvestment
{
get;
set;
}

int intLevelAvailableAt
{

get;
set;
}
}
}
All that amounts to is a simple interface with things that are applicable to both lots and developed land. So based on that, we can have a signature set that is implemented in 2 other classes.

//Written by Joseph I. Szweda
//July 6, 2009
//This is a class that implements the IMobsterRealEstate
//interface for developed land.

using System;
using System.Collections.Generic;
using System.Text;

namespace MobstersRealEstate
{
class MobstersDevlopedLand : MobsterRealEstate.IMobsterRealEstate
{

//Construct
MobstersDevlopedLand()
{
}

//Destructor
~MobstersDevlopedLand()
{
}

//locals
private string m_strRealEstateName;
private int m_intRealEstateQuantity;
private int m_intBaseCost;
private int m_intIncome;
private int m_intCurrentPrice;
private decimal m_decReturnOnInvestment;
private int m_intLevelAvailableAt;

#region IMobsterRealEstate Members

string MobsterRealEstate.IMobsterRealEstate.strRealEstateName
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_strRealEstateName;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_strRealEstateName = value;
}
}

int MobsterRealEstate.IMobsterRealEstate.intRealEstateQuantity
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_intRealEstateQuantity;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_intRealEstateQuantity = value;
}
}

int MobsterRealEstate.IMobsterRealEstate.intBaseCost
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_intBaseCost;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_intBaseCost = value;
}
}

int MobsterRealEstate.IMobsterRealEstate.intIncome
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_intIncome;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_intIncome = value;
}
}

int MobsterRealEstate.IMobsterRealEstate.intCurrentPrice
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_intCurrentPrice;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_intCurrentPrice = value;
}
}

decimal MobsterRealEstate.IMobsterRealEstate.decReturnOnInvestment
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_decReturnOnInvestment;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_decReturnOnInvestment = value;
}
}

int MobsterRealEstate.IMobsterRealEstate.intLevelAvailableAt
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_intLevelAvailableAt;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_intLevelAvailableAt = value;
}
}

#endregion
}
}

Then for developed land, we can see the reuse of the same interface:

//Written by Joseph I. Szweda
//July 6, 2009
//This is a class that implements the IMobsterRealEstate
//interface for undeveloped land.

using System;
using System.Collections.Generic;
using System.Text;

namespace MobstersRealEstate
{
class MobstersUndevlopedLand:MobsterRealEstate.IMobsterRealEstate
{

//Construct
MobstersUndevlopedLand()
{
}

//Destructor
~MobstersUndevlopedLand()
{
}

//locals
private string m_strRealEstateName;
private int m_intRealEstateQuantity;
private int m_intBaseCost;
private int m_intIncome;
private int m_intCurrentPrice;
private decimal m_decReturnOnInvestment;
private int m_intLevelAvailableAt;

#region IMobsterRealEstate Members

string MobsterRealEstate.IMobsterRealEstate.strRealEstateName
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_strRealEstateName;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_strRealEstateName = value;
}
}

int MobsterRealEstate.IMobsterRealEstate.intRealEstateQuantity
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_intRealEstateQuantity;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_intRealEstateQuantity = value;
}
}

int MobsterRealEstate.IMobsterRealEstate.intBaseCost
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_intBaseCost;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_intBaseCost = value;
}
}

int MobsterRealEstate.IMobsterRealEstate.intIncome
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_intIncome;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_intIncome = value;
}
}

int MobsterRealEstate.IMobsterRealEstate.intCurrentPrice
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_intCurrentPrice;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_intCurrentPrice = value;
}
}

decimal MobsterRealEstate.IMobsterRealEstate.decReturnOnInvestment
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_decReturnOnInvestment;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_decReturnOnInvestment = value;
}
}

int MobsterRealEstate.IMobsterRealEstate.intLevelAvailableAt
{
get
{
//throw new Exception("The method or operation is not implemented.");
return this.m_intLevelAvailableAt;
}
set
{
//throw new Exception("The method or operation is not implemented.");
this.m_intLevelAvailableAt = value;
}
}

#endregion
}
}
That's basically the very basic code and format I am using to start to frame things up. The nice thing about this is a few things that no employer or PM I've met seems to really understand or care too.

1. This is reusable.
2. It's generic. I can implement this into a web site with ease. I can use it for a Windows client, or both.
3. With a little documentation, you can easily reference the assembly, and make your own custom implementation of the same business object with the same interface. You just pass in an instance of the IMobstersRealEstate interface, and it will work so long as your references are right.

I have some other classes to work on, some custom exception handlers that will go along with these, and of course some validators.

I am still trying to rethink the architecture in comparison to the last Windows based project I did. There is no real data layer, but there is an XML layer. So things are a little backwards in comparison to how you do these things.

I have an XML API that I wrote. The issue is that for me to populate and serialize XML, I would have to inherit my class. Well, that starts to look like a data access tier, so maybe I ought to clone this. If I do, there will be one aspect that is a clone that inherits the API, and perhaps another that inherits some validator classes. It's either that or I have some delegates to stick in.

The thing is if I start using delegates, I fear a mish mosh of data access and business objects. All I really want is a 2 fold thing. I want to be able to access certain XML files in a granular format to minimize maintenance as the game has new items so that the user can simply enter what they want, it gets serialized, the end. Think it's a pipe dream? So did a client I once had before. I made it happen, and I can reuse the same technology here.

So here is the way I envision this working. Have something that inherits my XML API for data access, and maybe modify the constructs for the clones to be instantiated with another object instance of like kind from the parent clone in the data tier. Then I can have a bona fide data access tier, and I can have something to accept data from my presentation tier without intermingling the two.

Yes, it's 2 copies of the same thing-maintenance. However, if I implement this right, and reuse the same exact interfaces, it's really 2 different implementations of the same interface. So...that kinda solves itself or at least most of the headaches there. Smile

As for all the calculations and things, that's all going to live in dedicated business tiers. That's all there is to it. It's a lot easier than using macro's and stinky script. Also, I have an idea for a Mogul Version for the extreme real estate moguls that would use SQL Express in addition to what I propose. That would make n-tier a must. That might be a bit overboard, but there is a point to doing that for certain short sale tactics and such. :-)

So...it's back to architecting more interfaces, DLL's, validators, and of course custom collections to be used by the bussiness tier. Smile

Happy mobbing...and stay tuned.

-joe

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <strike> <caption> <thead> <th> <param> <style> <BGSOUND> <color> <center> <font-size> <script>
  • You may quote other posts using [quote] tags.
  • Filtered words will be replaced with the filtered version of the word.
  • Textual smileys will be replaced with graphical ones.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <csharp>, <css>, <html4strict>, <javascript>, <php>, <vb>, <vbnet>, <xml>. Beside the tag style "<foo>" it is also possible to use "[foo]".
  • Lines and paragraphs break automatically.
  • You can use BBCode tags in the text.

More information about formatting options



NOT LOGGED IN

You are NOT logged in

NOTE: You are commenting as an anonymous guest. You will NOT immediately see your comment, but it's there. Please do not try to re-send the same comment. If you'd like to see it immediately, please login or create an account (no worries, it's free).


facebook codes exploits tips tricks Phrozen Crew
All contents ©Copyright GeekDrop 2009-2012
TOS | Privacy Policy