That's clever. I never thought of that. Not only something concrete,
like people, could be class, but a procedure, like a Session, could
also be a Class.
Thanks for you all who replied. I learned a lot from this thread and
I even made some notes of all your advices because I think I might
Note sure who wrote:
Consolidate existing functions?
I've thought about it.
For example, I have two functions:
#=
def startXXX(id):
pass
def startYYY(id):
pass
#=
I could turn it into one:
andrew cooke wrote:
[...]
#=
def start(type, id):
if(type == XXX):
pass
else if(type == YYY):
pass
#=
i just realised i am assuming type is a type of an object, but you might
be using it to mean something else
On Apr 3, 7:18 am, Emile van Sebille em...@fenx.com wrote:
So, I think the question becomes, when does code need
refactoring?
I would say that 99.9% of the times a single class with 15,000
lines of code is a signal that something is wrong,
and refactoring is needed.
M. Simionato
--
Consolidate existing functions?
I've thought about it.
For example, I have two functions:
#=
def startXXX(id):
pass
def startYYY(id):
pass
#=
I could turn it into one:
#=
def start(type, id):
if(type ==
On Thu, 02 Apr 2009 22:18:02 -0700, Emile van Sebille wrote:
Steven D'Aprano wrote:
On Thu, 02 Apr 2009 16:51:24 -0700, Emile van Sebille wrote:
snip
I refactor constantly during development to avoid code reuse through
cut-n-paste, but once I've got it going, whether it's 1000 or 6000
Steven D'Aprano wrote:
On Thu, 02 Apr 2009 22:18:02 -0700, Emile van Sebille wrote:
Steven D'Aprano wrote:
On Thu, 02 Apr 2009 16:51:24 -0700, Emile van Sebille wrote:
snip
I refactor constantly during development to avoid code reuse through
cut-n-paste, but once I've got it going, whether
Emile van Sebille wrote:
Whether you (generic you) choose to do so or not is a separate issue.
Also agreed - and that is really my point. Doing so feels to me like
continuing to look for a lost object once you've found it.
i can see your point here, but there's two things more to consider:
andrew cooke wrote:
Emile van Sebille wrote:
Whether you (generic you) choose to do so or not is a separate issue.
Also agreed - and that is really my point. Doing so feels to me like
continuing to look for a lost object once you've found it.
i can see your point here, but there's two
一首诗 schrieb:
Consolidate existing functions?
I've thought about it.
For example, I have two functions:
#=
def startXXX(id):
pass
def startYYY(id):
pass
#=
I could turn it into one:
#=
def
On Apr 2, 11:25 pm, 一首诗 newpt...@gmail.com wrote:
Consolidate existing functions?
I've thought about it.
For example, I have two functions:
#=
def startXXX(id):
pass
def startYYY(id):
pass
#=
I could turn it into one:
On Thu, 02 Apr 2009 18:47:29 +1300, Lawrence D'Oliveiro wrote:
The question is not how many lines or how many methods, but whether it
makes sense to remain as one piece or not. In one previous project, I
had one source file with nearly 15,000 lines in it. Did it make sense
to split that up?
Steven D'Aprano wrote:
cut
If you have too much code in one file, it will upset the balance of the
spinning hard drive platter, and it will start to wobble and maybe even
cause a head-crash.
That is why proper designed operating systems, like windows 95,rarely
write one continuous block but
2009/4/1 一首诗 newpt...@gmail.com:
Hi all,
I am a programmer who works with some different kinds of programming
languages, like python, C++(in COM), action script, C#, etc.
Today, I realized that, what ever language I use, I always meet a same
problem and I think I never solve it very well.
Lawrence D'Oliveiro wrote:
What are the average size of source files in your project? If it's
far lower than 15,000, don't feel it's a little unbalance?
Why?
one reason is that it becomes inefficient to find code. if you structure
code as a set of nested packages, then a module, and
On Thu, 02 Apr 2009 07:45:46 -0400, andrew cooke wrote:
Lawrence D'Oliveiro wrote:
What are the average size of source files in your project? If it's
far lower than 15,000, don't feel it's a little unbalance?
Why?
one reason is that it becomes inefficient to find code. if you
You get it. Sometimes I feel that my head is trained to work in a
procedural way. I use a big class just as a container of functions.
About the data-based approach, what if these functions all shares a
little data, e.g. a socket, but nothing else?
On Apr 2, 5:58 am, Carl Banks
[top-posting fixed]
On Thu, 2 Apr 2009 08:02:23 -0700 (PDT), =?GB2312?B?0rvK18qr?=
newpt...@gmail.com wrote:
On Apr 2, 5:58 am, Carl Banks pavlovevide...@gmail.com wrote:
On Apr 1, 12:44 am, ?? newpt...@gmail.com wrote:
I got the same problem when writing C#/C++ when I have to provide a
On Apr 2, 8:02 am, 一首诗 newpt...@gmail.com wrote:
You get it. Sometimes I feel that my head is trained to work in a
procedural way. I use a big class just as a container of functions.
About the data-based approach, what if these functions all shares a
little data, e.g. a socket, but nothing
一首诗 wrote:
Hi all,
I am a programmer who works with some different kinds of programming
languages, like python, C++(in COM), action script, C#, etc.
Today, I realized that, what ever language I use, I always meet a same
problem and I think I never solve it very well.
The problem is : how to
On Thu, 02 Apr 2009 16:51:24 -0700, Emile van Sebille wrote:
一首诗 wrote:
Hi all,
I am a programmer who works with some different kinds of programming
languages, like python, C++(in COM), action script, C#, etc.
Today, I realized that, what ever language I use, I always meet a same
Steven D'Aprano wrote:
On Thu, 02 Apr 2009 16:51:24 -0700, Emile van Sebille wrote:
snip
I refactor constantly during development to avoid code reuse through
cut-n-paste, but once I've got it going, whether it's 1000 or 6000
lines, it doesn't matter as long as it works.
If you've been
In message 48506803-a6b9-432b-acef-
b75f76e90...@v23g2000pro.googlegroups.com, 一首诗 wrote:
Until one day I find service has nearly 100 methods and 6000 lines of
code. I don't need to read any programming book to know that it's
too big.
The question is not how many lines or how many methods,
Ò»Ê×Ê« wrote:
3. completely move codes in service to business classes. Initialize
these classes and pass them to protocol classes.
These protocol classes calls these instances of business classes
instead of call service. These means whenever I add a new business
class. I have to add a
I also think that's my best choice. Before I wrote my mail, I
already knew that this is not a good question. It lacks details, and
it is too big.
But I think the first step to resolve a problem is to describe it. In
that way, I might find the answer myself
On Apr 1, 6:40 pm, andrew cooke
On Apr 1, 4:55 pm, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
In message 48506803-a6b9-432b-acef-
b75f76e90...@v23g2000pro.googlegroups.com, 一首诗 wrote:
Until one day I find service has nearly 100 methods and 6000 lines of
code. I don't need to read any programming book
On Wed, Apr 1, 2009 at 3:40 PM, 一首诗 newpt...@gmail.com wrote:
What are the average size of source files in your project? If it's
far lower than 15,000, don't feel it's a little unbalance?
--
http://mail.python.org/mailman/listinfo/python-list
While I think 15,000 is, in the vast
一首诗 newpt...@gmail.com wrote:
But I think the first step to resolve a problem is to describe it. In
that way, I might find the answer myself
:-) That is a great saying!
To answer your original question, split your code up into sections
that can be tested independently. If you can test code
一首诗 wrote:
cut
But I think the first step to resolve a problem is to describe it. In
that way, I might find the answer myself
cut
That is an excellent approach, knowing you have a problem and describing
it is actually the hardest part of a design, the rest is more like a puzzle.
What I
On Apr 1, 12:44 am, 一首诗 newpt...@gmail.com wrote:
I got the same problem when writing C#/C++ when I have to provide a
lot of method to my code's user. So I create a big class as the entry
point of my code. Although these big classes doesn't contains much
logic, they do grow bigger and
In message 158986a9-b2d2-413e-9ca0-
c584299f1...@f1g2000prb.googlegroups.com, 一首诗 wrote:
On Apr 1, 4:55 pm, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
In message 48506803-a6b9-432b-acef-
b75f76e90...@v23g2000pro.googlegroups.com, 一首诗 wrote:
Until one day I find service
31 matches
Mail list logo