Re: How to divide my apps? Good practices?

2013-06-23 Thread galgal





I've made a quick schema of couple of main tables. As you can see, there 
are many relations, so I think putting it all in one app. There will be a 
couple of additional models. There will be 1 more thing: a play systems. 
Some seasons can have simple table games but others - of example 2 rounds 
of regular matches etc... That will be a special, separated class for that, 
in the same app as rest I think.

What do you think?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to divide my apps? Good practices?

2013-06-22 Thread galgal


I've made a quick schema of couple of main tables. As you can see, there 
are many relations, so I think putting it all in one app. There will be a 
couple of additional models. There will be 1 more thing: a play systems. 
Some seasons can have simple table games but others - of example 2 rounds 
of regular matches etc... That will be a special, separated class for that, 
in the same app as rest I think.

What do you think?





On Thursday, June 20, 2013 11:01:30 PM UTC+2, galgal wrote:
>
> Hi,
> I'm starting my new project. It's sport-connected.
> The main part of my app will be league, matches, teams and players. There 
> will be many relations.
>
> So, how to make apps and models. I plan to make models:
>
>- Season
>- League (FK to Season)
>- Team
>- Match (FK to League and 2FK to Teams)
>- Players (FK to Team)
>- and many more to present teams history in each season etc.
>
> Is it better, to make it all in 1 app, called for example Game, or divide 
> it into smaller apps?
> Thanks for help.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to divide my apps? Good practices?

2013-06-21 Thread Tim Chase
On 2013-06-21 09:29, galgal wrote:
> But I can see now that there will be a massive amount of models.
[snip]
> I will have at least 15 models in it and I think it will
> increase in some time

Just as an aside, having worked developing a lot of
business/"enterprise" applications, 15 models is a pretty simple
world.  I usually think of "massive amount of models" as at least a
hundred, often several hundred.

So the rule of thumb is to separate your logical/functional units
(registration, team/league management, game management, common
models, reporting, etc) rather than by models.

-tkc



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to divide my apps? Good practices?

2013-06-21 Thread Christian Schmitt
That is fine in one app. just seperate them. delete models.py and make a 
package named models. import every model in the __init__.py file from 
models.py, make sure u set a class Meta: app_label = 'your app name' to 
every model and you have a very clean app structure.

Am Freitag, 21. Juni 2013 18:29:44 UTC+2 schrieb galgal:
>
> But I can see now that there will be a massive amount of models. Each 
> player should have his own statistics for each games, there will also be a 
> part for referees. Referee work will be rated by users so - many models is 
> planned. If I put it in one app, I will have at least 15 models in it and I 
> think it will increase in some time
>
> Division in my example will clarify it, for example players app with all 
> models for players like player base, player in season, player statistics 
> and of course all logic in it.
>
> In 1 app there will be a many many lines of code and after some time it 
> will be hard to develop I think.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to divide my apps? Good practices?

2013-06-21 Thread Tom Evans
On Fri, Jun 21, 2013 at 5:29 PM, galgal  wrote:
> In 1 app there will be a many many lines of code and after some time it will 
> be hard to develop I think.

Sorry, I just wanted to reply to just this line as well!

There is no problem with having apps with a lot of code. Each part of
an app - models, views, templates, tests, urls etc - can easily be
split up into smaller logical components. If there is not a good
reason to split it into separate apps, then do not do it.

For instance, in your proposed sport/league project, you *could*
separate each model in to a separate app. This would work fine, but be
completely pointless.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to divide my apps? Good practices?

2013-06-21 Thread Tom Evans
On Fri, Jun 21, 2013 at 5:29 PM, galgal  wrote:
> But I can see now that there will be a massive amount of models. Each player 
> should have his own statistics for each games, there will also be a part for 
> referees. Referee work will be rated by users so - many models is planned. If 
> I put it in one app, I will have at least 15 models in it and I think it will 
> increase in some time
>
> Division in my example will clarify it, for example players app with all 
> models for players like player base, player in season, player statistics and 
> of course all logic in it.
>
> In 1 app there will be a many many lines of code and after some time it will 
> be hard to develop I think.
>

Welcome to software development.


In general, draw a diagram of your models and how they relate to each
other. Separate models which logically are only slightly related into
different packages - literally draw a line around the models in the
diagram.

For example, in your sports models, you have primitive objects like a
Game, a Player, a League, a Team and so on. All these are highly
coupled together, and belong together. Later on, you discuss
statistics on one of these things. Statistics are only loosely related
to the primitive game objects, and so should be in a separate package.

A useful rule of thumb is that if you have a package "A", it can
import from "B", but "B" should not import from "A". If they do, they
are tightly coupled and should belong in the same package (or,
potentially, your design is unclean - tight coupling is not a desired
trait of software components).

If you are more interested in this topic, I'd read "Software
Engineering - a Practitioners Approach" by Pressman.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to divide my apps? Good practices?

2013-06-21 Thread galgal
But I can see now that there will be a massive amount of models. Each player 
should have his own statistics for each games, there will also be a part for 
referees. Referee work will be rated by users so - many models is planned. If I 
put it in one app, I will have at least 15 models in it and I think it will 
increase in some time

Division in my example will clarify it, for example players app with all models 
for players like player base, player in season, player statistics and of course 
all logic in it.

In 1 app there will be a many many lines of code and after some time it will be 
hard to develop I think.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to divide my apps? Good practices?

2013-06-21 Thread Christian Schmitt
You shouldn't divine things that should be together. Better make things 
together like, game, forum, blog. Don't make a app for too many things.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to divide my apps? Good practices?

2013-06-21 Thread galgal
@Mayukh Mukherjee yes, I have that in mind. That's why I'm asking about 
it:) I'm confused now and need any advice if that all models should be in 1 
app, or in couple of apps.

I'm rather convinced to make couple of apps

   - teams (models with teams - at least 2 models. team as global in my 
   app, and team in the season (its name, etc))
   - players (the same as above)
   - leagues with different competitions systems
   - etc...

It should be better in future to develop new features.

On Friday, June 21, 2013 3:30:48 PM UTC+2, Mayukh Mukherjee wrote:
>
> Just some generic advice -- keep each app focused on one individual 
> task,as a rule of thumb you'd want maybe 5 +/- 2 models per app. Better to 
> have multiple apps that each do one thing well than one large app that does 
> everything.
>
>
> Best
>
>
>
> On Thu, Jun 20, 2013 at 5:01 PM, galgal 
> > wrote:
>
>> Hi,
>> I'm starting my new project. It's sport-connected.
>> The main part of my app will be league, matches, teams and players. There 
>> will be many relations.
>>
>> So, how to make apps and models. I plan to make models:
>>
>>- Season
>>- League (FK to Season)
>>- Team
>>- Match (FK to League and 2FK to Teams)
>>- Players (FK to Team)
>>- and many more to present teams history in each season etc.
>>
>> Is it better, to make it all in 1 app, called for example Game, or divide 
>> it into smaller apps?
>> Thanks for help.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Mayukh Mukherjee
> http://www.linkedin.com/in/mayukhmmukherjee
>
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to divide my apps? Good practices?

2013-06-21 Thread Mayukh Mukherjee
Just some generic advice -- keep each app focused on one individual task,as
a rule of thumb you'd want maybe 5 +/- 2 models per app. Better to have
multiple apps that each do one thing well than one large app that does
everything.


Best



On Thu, Jun 20, 2013 at 5:01 PM, galgal  wrote:

> Hi,
> I'm starting my new project. It's sport-connected.
> The main part of my app will be league, matches, teams and players. There
> will be many relations.
>
> So, how to make apps and models. I plan to make models:
>
>- Season
>- League (FK to Season)
>- Team
>- Match (FK to League and 2FK to Teams)
>- Players (FK to Team)
>- and many more to present teams history in each season etc.
>
> Is it better, to make it all in 1 app, called for example Game, or divide
> it into smaller apps?
> Thanks for help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mayukh Mukherjee
http://www.linkedin.com/in/mayukhmmukherjee

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




How to divide my apps? Good practices?

2013-06-20 Thread galgal
Hi,
I'm starting my new project. It's sport-connected.
The main part of my app will be league, matches, teams and players. There 
will be many relations.

So, how to make apps and models. I plan to make models:

   - Season
   - League (FK to Season)
   - Team
   - Match (FK to League and 2FK to Teams)
   - Players (FK to Team)
   - and many more to present teams history in each season etc.
   
Is it better, to make it all in 1 app, called for example Game, or divide 
it into smaller apps?
Thanks for help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.