Re: [Tutor] Object oriented design

2015-12-22 Thread Mark Lawrence
On 22/12/2015 02:15, Danny Yoo wrote: On Mon, Dec 21, 2015 at 5:58 PM, Alan Gauld wrote: On 22/12/15 00:14, jamie hu wrote: Thanks Alan. I was thinking about making a list of objects and search through it, but wasn't sure if that was right way. For small numbers of objects( aa few h

Re: [Tutor] Object oriented design

2015-12-21 Thread jamie hu
* * 20.12.2015, 12:49, "Danny Yoo" : On Sat, Dec 19, 2015 at 4:48 PM, jamie hu <[1]jamieh...@yandex.com> wrote: I am starting with Python object oriented concepts and have difficulty in understanding object instantiation. Below is an example code th

Re: [Tutor] Object oriented design

2015-12-21 Thread jamie hu
* * 20.12.2015, 01:25, "Alan Gauld" : On 20/12/15 00:48, jamie hu wrote: trying to think/implement. I can create a given student object based on given firstname, lastname and grade. How do I find all objects matching particular criteria

Re: [Tutor] Object oriented design

2015-12-21 Thread Danny Yoo
> > Thanks Danny. I was confused about what to return and How? Should I return > user objects for User.find_by_lastname() method and do I need to > re-instantiate objects? > If we pull a value out of an in-memory container, we've got it already in hand. For example, here's a little interaction:

Re: [Tutor] Object oriented design

2015-12-21 Thread Alan Gauld
On 22/12/15 00:17, jamie hu wrote: >I think storing them as a list in memory solves this issue. If I were to >use database I will need to search and create object again while returning >to user. Is that right?* Yes, although you can keep a list of instantiated objects in memory (somet

Re: [Tutor] Object oriented design

2015-12-21 Thread Danny Yoo
On Mon, Dec 21, 2015 at 5:58 PM, Alan Gauld wrote: > On 22/12/15 00:14, jamie hu wrote: > >>Thanks Alan. I was thinking about making a list of objects and search >>through it, but wasn't sure if that was right way. > > For small numbers of objects( aa few hundreds say) its the easiest opti

Re: [Tutor] Object oriented design

2015-12-21 Thread Alan Gauld
On 22/12/15 00:14, jamie hu wrote: >Thanks Alan. I was thinking about making a list of objects and search >through it, but wasn't sure if that was right way. For small numbers of objects( aa few hundreds say) its the easiest option. >I wasn't sure instantiation needed when using data

Re: [Tutor] Object oriented design

2015-12-20 Thread Danny Yoo
On Sat, Dec 19, 2015 at 4:48 PM, jamie hu wrote: >I am starting with Python object oriented concepts and have difficulty in >understanding object instantiation. Below is an example code that I am >trying to think/implement. I can create a given student object based on >given firstn

[Tutor] Object oriented design

2015-12-20 Thread jamie hu
* Hi, I am starting with Python object oriented concepts and have difficulty in understanding object instantiation. Below is an example code that I am trying to think/implement. I can create a given student object based on given firstname, lastname and grade. How do I find all ob

Re: [Tutor] Object oriented design

2015-12-20 Thread Alan Gauld
On 20/12/15 00:48, jamie hu wrote: >trying to think/implement. I can create a given student object based on >given firstname, lastname and grade. How do I find all objects matching >particular criteria and return them to caller? Do I need to iterate/select >through some list/databa

Re: [Tutor] Object-oriented design process

2005-11-27 Thread Kent Johnson
Alan Gauld wrote: >> I think you work at a much larger scale (of program size) than I do > > That's probably true. > > An average project for me involves about 3 months of architecture/design > generating maybe 5 or 6 workpackages given to different teams, each of > which will comprise between 10

Re: [Tutor] Object-oriented design process

2005-11-27 Thread Alan Gauld
> I think you work at a much larger scale (of program size) than I do That's probably true. My day job is as a systems architect/designer, most of the real coding is done by development teams scattered across the country. I use Python to prove the concepts of my design before converting it into Ja

Re: [Tutor] Object-oriented design process

2005-11-26 Thread Kent Johnson
Alan Gauld wrote: > I never use commonality of data to define a class. OK I lie, sometimes > its just convenient to do it that way, but as a principle > such classes are rarely extensible, they tend to be more like records in > structured programming speak. Very few of my classes are ever extend

Re: [Tutor] Object-oriented design process

2005-11-26 Thread Alan Gauld
Hi Kent, >> point. Classes express behaviour, the data is only there to support >> the behaviour. Thats why methods are polymorphic but not attributes. >> >> So you think of a class having an interface and users extending >> or modifying the behaviour, not the data. > I think of a class in ter

[Tutor] Object-oriented design process

2005-11-26 Thread Kent Johnson
Alan Gauld wrote: > That might be part of the problem, if you think of a class in terms > of its data attributes then that is nearly always the wrong starting > point. Classes express behaviour, the data is only there to support > the behaviour. Thats why methods are polymorphic but not attribut