473,770 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Advice: How do I...

Hi all,

I'm looking for some advice on how best to achitect the following
requirement.

I'm basically writing a Fantasy Football (FF) Web site, and would like
to have it fully OO and have it using as much inheritance, base
classes, common methods, etc as possible.

My biggest headache that I cant get my head around is how to handle
teams and players. The basic scenario of requirements is:

There are 1+ FF leagues
Each FF leage hase 1+ teams
Each FF team has 11+ players
Each FF player can be either goalie, defender, attacker
Each FF player has a monetery value
Each FF player has a number of points per game
There are X number of games per season
There are X number of seasons

Each player in a FF Team comes from an actual REAL football player
A real player can only exist in one FF league
A real player can be active or inactive (and as such the FF player
inherits from this)
A real player has a number of points per game (if the player is a FF
player, then for the appropriate game the FF player gets the points)

I can work out some base classes, properties and methods, but would
find some technical architecture advice invaluable. Any and all output
I produce will be shared!

Thanks all!

Jul 7 '06 #1
8 1524
Hi George,

Fully-OOP is good. Using "as much inheritance, base classes, common methods,
etc as possible" is not good. The purpose of OOP is to make programming
easier, faster, better organized, and more intuitive. Note that none of
these things is any of the things you mentioned wanting to use. That's
because the things you mentioned are tools. Tools do not dictate, nor are
they requirements. If you were going to build a house, and you had a
26-ounce Framing hammer, would you say that you wanted to use the new
Framing hammer as much as possible? Of course not. You really need to use it
as much as necessary.

The difference here is that "OOP" is a set of tools and principles that
defines a methodology for programming. The methodology is good. The tools it
employs are neither good nor bad, except in the context of what you do with
them. The only reason I mention this is that many people have a tendancy to
get too attached to the tools and methodologies, and take their attention
off of the goals/requirements. You can find yourself a good way down the
garden path if you go that way.

The primary principle of OOP is that programming entities should resemble
and be treated as "real-life things." That is, rather than thinking about
the nitty-gritty details of process and data (when designing), think about
all of these as objects. This is the way we humans typically perceive the
world. Data is (almost) always associated with some "real-life" entity. Your
object model should reflect that association.

Another principle is that objects should "mind their own business." That is,
as much as possible, an object should manage itself, rather than being
managed by something else outside of it. This lessens dependencies, allowing
classes to be reused in a wider configuration of apps, and makes the overall
application much simpler. So, for example, a League has a collection of
Teams, a team has a collection of players, and if a player needs his/her
shoe tied, he/she shouldn't have to have a League tie it for him. But on the
other hand, if a Team needs to remove a player, it is not changing the
player, but the Team; therefore, that is an action that is appropriate for a
Team.

So, applying these principles to your requirements:

You have mentioned a number of entities:

League
Team
Player
Goalie
Defender
Attacker
Game
Season

The first 3 items are fairly straightforward . A League has a Collection of
Teams. Note that I didn't say "a league *is* a collection of Teams." There
is an important distinction there. There may be other aspects to a League
that are not specific to Teams. For example, a League's standing is not part
of a team; it is a property of a League. So, I would create a class that
*has* a Collection of Teams.

A Team has a Collection of players. Same story here.

A Player is a player. Now, you have some decisions to make regarding the
"roles" of a player (Goalie, Defender, Attacker). No doubt you're wondering
whether or not to use a base class "Player" and 3 derived classes. Well,
let's walk through that one. Inheritance is useful when you want to extend a
set of common attributes to several sub-classes with unique attributes. It
is useful when you may want to treat any of the derived classes as if they
were the base class (such as referring to a "Goalie" as a "Player" for the
purpose of incorporating it into a Team). However, if a Player can change
their "role" you would not want to use inheritance, as the Player would have
to change type to make the change. Another principle of OOP is that you only
use a type when the type is not expected to change.

On the other hand, you may be talking about some relatively simple
differences here. What makes a Goalie different than an Attacker or a
Defender? (Pardon me for not having played FF before). If the number of
differences is great, a derived class may be a good idea. OTOH, if it
doesn't make a lot of difference, simply setting a property or 2 in the
Player class may do enough.

In the end, you have to weigh all of the conditions, and make a decision.

As for Games and Seasons, that is another difficult issue. A Game is a
process which involves players, but is a temporary process, and may involve
any number of different players (at least any combination of 2 Teams).
Obviously, as there are multiple Games per Season, a Season would suggest a
class that has a collection of Games. A Game might be thought of as having 2
teams, which would indicate 2 properties. However, how do we link each
player in each team with each Game, for the purpose of playing and keeping
statistics? Since each player can play in many games, and each game can have
many players, in a database we would be talking about a "many to many"
relationship. A "many to many" relationship in a database is achieved by
using an intermediate table, which contains 2 columns, each linked to one of
the parent tables, and whatever other columns may be needed. The scoring
statistics sound like one of those things that would be shared between one
class and another, so that detailed performance for each player can be
obtained, as well as summary performance information for each game.

Therefore, I would think that another class called "PlayerPoin ts" (or
something like that) be created, which includes a Player and a Game as
properties, and a number that represents the number of points which that
Player scored in that Game. Since each Player participlates in any number of
Games, each Player could have a Collection of Games played, and the
PlayerPoints would be a Collection of each Game. That way, you could create
properties for both the player and the game that can tally up their scores.

I hope this at least provides some ideas for you to think over.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
<ge************ *@gmail.comwrot e in message
news:11******** *************@s 16g2000cws.goog legroups.com...
Hi all,

I'm looking for some advice on how best to achitect the following
requirement.

I'm basically writing a Fantasy Football (FF) Web site, and would like
to have it fully OO and have it using as much inheritance, base
classes, common methods, etc as possible.

My biggest headache that I cant get my head around is how to handle
teams and players. The basic scenario of requirements is:

There are 1+ FF leagues
Each FF leage hase 1+ teams
Each FF team has 11+ players
Each FF player can be either goalie, defender, attacker
Each FF player has a monetery value
Each FF player has a number of points per game
There are X number of games per season
There are X number of seasons

Each player in a FF Team comes from an actual REAL football player
A real player can only exist in one FF league
A real player can be active or inactive (and as such the FF player
inherits from this)
A real player has a number of points per game (if the player is a FF
player, then for the appropriate game the FF player gets the points)

I can work out some base classes, properties and methods, but would
find some technical architecture advice invaluable. Any and all output
I produce will be shared!

Thanks all!

Jul 7 '06 #2
Kevin,

I can't speak for George, but I found your post very interesting and
relevant. I often find that I have to guard against the very mistake
you mention - implementing a tool or methodology for the mere sake of
doing so. Thank you for taking the time to offer a bit of good advice
on the matter.

I also found it interesting that when George mentioned a fantasy
football website, I just assumed American football. When your examples
used aspects of European football, I had one of those, "Huh. I never
really thought about it" moments. I am well aware of the different uses
of the term "football", but I had never considered that it only stood
to reason that the "fantasy football" we play in the states therefore
might also mean something different across the pond. :P

Anyway, thanks again for your insight. Might you have any links to
additional resources in the way of entity relationship modelling for
mere mortals? In the past, searches on Google tended to turn up
resources that pertain to much more complex scenarios and methods than
I have typically needed to address.

Rich

Jul 7 '06 #3
Thanks Richard,
I also found it interesting that when George mentioned a fantasy
football website, I just assumed American football. When your examples
used aspects of European football, I had one of those, "Huh. I never
really thought about it" moments.
I didn't realize my examples used aspects of European Football (that would
be soccer, right?). I just threw the same terms back that I heard. Actually,
I'm an American, and "sports-challenged" (never could get into watching
other people play games).
Anyway, thanks again for your insight. Might you have any links to
additional resources in the way of entity relationship modelling for
mere mortals? In the past, searches on Google tended to turn up
resources that pertain to much more complex scenarios and methods than
I have typically needed to address.
Now, that's a challenge. Unfortunately, I spoke out of experience, including
reading quite a lot about the subjects over quite a few years, so I don't
have any links about it specifically. The challenge for me would be to
analyze my method of analysis and report it back accurately. I'm a visual
thinker anyway, so I tend to "see" ideas, which helps in the process. I also
tend to see things in analogies, which is also useful.

So, when I'm looking at a set of requirements, I will often think over the
words that are used to describe the requirements. Often, this will be useful
in itself, as we define requirements the way we think, in terms of objects.
For example:
There are 1+ FF leagues
Each FF leage hase 1+ teams
Each FF team has 11+ players
Each FF player can be either goalie, defender, attacker
Each FF player has a monetery value
Each FF player has a number of points per game
There are X number of games per season
There are X number of seasons
The nouns in the sentences give clues as to what sort of classes are needed
initially. Of course, figuring out the relationships is the hard part. I
tend to work off of a few guiding principles, and derive my specific rules
from them:

1. KISS (Avoid unnecessary complexity)
2. Only requirements drive the solution.
3. Avoid dependencies ("A class should mind its own business")
4. Think about the future (extensibility, future features and versions)
5. Occam's Razor: If it looks like an object, it probably should be one.
6. Use inheritance only when appropriate.
7. Often, a good database structure can suggest classes/relationships.
8. Always think at least twice about any decision.
9. Don't get too stuck on your original plan. Watch for opportunities.
10. KISS (Don't get lost in the process).

There's probably more that I'm not thinking about right now. I should
metnion that I'm from the Agile crowd, so that perspective seems to drive my
thinking quite a bit. However, I should mention that I'm only from the Agile
crowd by coincidence. I was Agile before the term existed. When I found out
about the term, I said to myself "So, that's what you are. Good to know
you've got company." I tend to sketch things out on paper, and use quite a
few notebooks for "thinking out loud."

Don't know if that helps any, but there it is!

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
"Richard Carpenter" <ru*******@hotm ail.comwrote in message
news:11******** **************@ 75g2000cwc.goog legroups.com...
Kevin,

I can't speak for George, but I found your post very interesting and
relevant. I often find that I have to guard against the very mistake
you mention - implementing a tool or methodology for the mere sake of
doing so. Thank you for taking the time to offer a bit of good advice
on the matter.

I also found it interesting that when George mentioned a fantasy
football website, I just assumed American football. When your examples
used aspects of European football, I had one of those, "Huh. I never
really thought about it" moments. I am well aware of the different uses
of the term "football", but I had never considered that it only stood
to reason that the "fantasy football" we play in the states therefore
might also mean something different across the pond. :P

Anyway, thanks again for your insight. Might you have any links to
additional resources in the way of entity relationship modelling for
mere mortals? In the past, searches on Google tended to turn up
resources that pertain to much more complex scenarios and methods than
I have typically needed to address.

Rich

Jul 7 '06 #4
Kevin Spencer wrote:
Thanks Richard,
I also found it interesting that when George mentioned a fantasy
football website, I just assumed American football. When your examples
used aspects of European football, I had one of those, "Huh. I never
really thought about it" moments.

I didn't realize my examples used aspects of European Football (that would
be soccer, right?). I just threw the same terms back that I heard. Actually,
I'm an American, and "sports-challenged" (never could get into watching
other people play games).
Right you are. It was George that mentioned the player positions in
soccer terms first. Not sure why I missed that. Ah well. I just found
my own initial reaction interesting, but I digress... :P
The nouns in the sentences give clues as to what sort of classes are needed
initially.
That is typically where I start.
1. KISS (Avoid unnecessary complexity)
Sometimes I feel that term was coined with me specifically in mind. :P
4. Think about the future (extensibility, future features and versions)
This is another area where I tend to get bogged down. Maybe my crystal
ball just needs a good cleaning.
7. Often, a good database structure can suggest classes/relationships.
Interesting. I am typically responsible for designing the databases as
well as the applications they support, and I've always considered it
the other way around - normalize the data structures for efficiency and
rely on the business layer to reflect and support the entities and
their relationships. That approach has just always made sense to me. Of
course, it could just be because my database design skills are just
lacking. ;)
There's probably more that I'm not thinking about right now. I should
metnion that I'm from the Agile crowd, so that perspective seems to drive my
thinking quite a bit. However, I should mention that I'm only from the Agile
crowd by coincidence. I was Agile before the term existed. When I found out
about the term, I said to myself "So, that's what you are. Good to know
you've got company." I tend to sketch things out on paper, and use quite a
few notebooks for "thinking out loud."
I agree. I've not researched it much, but the term, "agile computing",
does strike me as a new name for what people have been doing (or
perhaps *should* have been doing) for some time now.
Don't know if that helps any, but there it is!
You bet. Thanks again.

Rich

Jul 7 '06 #5
Kevin,

This is exactly the kind of advice that I was looking for. Yes you are
correct, I need to seperate my OOP from my tools!

Yes, I was talking about "soccer". However, with good OOP I am sure
that it could be used for other similar team based sports.

I do agree with you in regards to the Database modeling. This is a
good indicator as to possible

As for the different types of players, it doesn't really matter. It's
simply a case that I limit the number of players per type. I.e. Only 1
goal keeper, up to 5 defenders, and up to 5 attackers. However, there
can only be a maximum of 11 players per team. For my purposes, no
player could change 'roles'.

Lastly, I didn't know that M$FT were hiring "Profession al Chicken Salad
Alchemist" :-)

George

Jul 10 '06 #6

ge************* @gmail.com wrote:
Kevin,

This is exactly the kind of advice that I was looking for. Yes you are
correct, I need to seperate my OOP from my tools!
On that subject, have a look at test driven development. Once you get
into the rhythm of it, it feels really natural and, while I'm not
fanatical about it (or much else), I now find it completely
indispensable whenever I'm working on something and I don't have an
immediate answer to the question "How is this going to work?".

Properly done, TDD will force you to evolve a sensible OO system little
by little and stop you delving TooDeepIntoTheB agOfTricks

http://c2.com/cgi/wiki?TooDeepIntoTheBagOfTricks

Jul 10 '06 #7
ge************* @gmail.com wrote:
Lastly, I didn't know that M$FT were hiring "Profession al Chicken Salad
Alchemist" :-)
They dont. The M$ MVP title doesn't make you a M$ emplyee. :)

http://mvp.support.microsoft.com/mvpexecsum
Jul 10 '06 #8
Hi George,

Glad I could help!

I have never worked for Microsoft. The MVP award is given to NON-Microsoft
professionals that help people with Microsoft issues voluntarily. If I *did*
work for Microsoft, you can bet my tag line would be different! ;-)

In any case, from my experience, *every* good developer is a "Chicken Salad
Alchemist." That is a person that makes Chicken Salad out of Chicken s**t on
a regular basis. There was a time in my career when I looked forward to the
day I wouldn't have to, but it never came! ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
<ge************ *@gmail.comwrot e in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
Kevin,

This is exactly the kind of advice that I was looking for. Yes you are
correct, I need to seperate my OOP from my tools!

Yes, I was talking about "soccer". However, with good OOP I am sure
that it could be used for other similar team based sports.

I do agree with you in regards to the Database modeling. This is a
good indicator as to possible

As for the different types of players, it doesn't really matter. It's
simply a case that I limit the number of players per type. I.e. Only 1
goal keeper, up to 5 defenders, and up to 5 attackers. However, there
can only be a maximum of 11 players per team. For my purposes, no
player could change 'roles'.

Lastly, I didn't know that M$FT were hiring "Profession al Chicken Salad
Alchemist" :-)

George

Jul 10 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

75
6190
by: Howard Nease | last post by:
Hello, everyone. I would appreciate any advice that someone could give me on my future career path. Here is my situation: I am a bright Junior in a very well-respected private high school, taking almost all AP and accelerated classes. I am HIGHLY interested in technology, more specifically the field of Computer Science and software engineering. I have heard a whole lot about the fact that the market for software engineers nowadays is...
5
3015
by: Martin Piper | last post by:
Hi all. I've recently landed myself the position of trainee C++ programmer which I'm extremely pleased about, but also nervous. According to the feedback from the interview, I have a good basic knowledge of C++ (through college) although my contract states that I must endeavour to learn more, so my question is - which areas of C++
3
2195
by: Andy Dingley | last post by:
I've just started on a new project and inherited a huge pile of XSLT (and I use the term "pile" advisedly !) It runs at glacial speed, and I need to fix this this. Platform is MSXML 4 / ASP Any advice on benchmarking tools / techniques ? I have no budget for tool-building, so if there's anything already out there, that would be good to know.
11
4754
by: ma740988 | last post by:
I'm perusing a slide with roughly 12 bullets spread across 3 pages. Each bullet reflects 'advice'. I'm ok with all but 1 bullet, more specifically the bullet that states: " Avoid the STL unless absolutely necessary " Now, I'm not acclimated with much C++ history, but something tells me this is akin to trepidation that surrounded C++ during it's inception? IOW, is this 'old school' rhetoric or ..... How do you refute this argument?
6
1806
by: J Rieggle | last post by:
Hi there, I am stuck on a problem that relates to eCommerce sites, but isnt ASP.NET specific (sorry). The ecommerce site is working in the UK, and products will be sold in pounds stirling. However, should I be presenting the currency figure in the currency of the visitor? I want to keep the site simple to begin with, so if I choose to render localized currencies, I probably need to something similar with the content too. I was...
13
3114
by: Alan Silver | last post by:
Hello, MSDN (amongst other places) is full of helpful advice on ways to do data access, but they all seem geared to wards enterprise applications. Maybe I'm in a minority, but I don't have those sorts of clients. Mine are all small businesses whose sites will never reach those sorts of scales. I deal with businesses whose sites get maybe a few hundred visitors per day (some not even that much) and get no more than ten orders per day....
7
2061
by: John Paul | last post by:
I'm thinking of building an e-commerce site in php. Anyone got any advice in building one? What is the best way to implement a payment system? Are any legal issues involved? Thanks,
232
13343
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
3
1879
by: mesut | last post by:
Hi colleagues, I need your advice... I have approx 1,5 years experience with ASP.NET/VB.NET 2005 and I have to switch over into C# 2005 language. I don't have experience with C# 2005 language. (but 10 years experience in mainframe languagues). My question is: I need a good book can someone advice it? I'm only interested in ASP.NET not in windows pages.
7
2164
by: SM | last post by:
Hello, I have a index.php template (2 columns). The right columns contains a bunch of links (interviews, poems, etc...) The left columns contains the actual article. So if I click on a link on the right menu, the article shows on the left column. The links have an url that look like this: http://www.myweb/library/?doc=194uf7s39
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10254
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.