Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.030 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'anyway.': 0.05; 'practice,': 0.07; 'function,': 0.09; 'logic': 0.09; 'cc:addr :python-list': 0.11; 'gui': 0.12; 'mythical': 0.16; 'scratch': 0.16; 'subject:GUI': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'code.': 0.18; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'question': 0.24; 'cc:2**0': 0.24; 'define': 0.26; 'least': 0.26; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'easier': 0.31; 'idea,': 0.31; 'file': 0.32; 'class': 0.32; 'url:python': 0.33; 'but': 0.35; 'received:google.com': 0.35; '14,': 0.36; 'url:listinfo': 0.36; 'doing': 0.36; 'next': 0.36; 'thanks': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'level': 0.37; 'pm,': 0.38; 'rather': 0.38; 'realize': 0.39; 'url:mail': 0.40; 'how': 0.40; 'days': 0.60; 'truly': 0.60; 'first': 0.61; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'jul': 0.74; 'concept.': 0.84; 'divided': 0.91; 'joel': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SeHcE3oVCN621lBFKS1DrnlcjGZ20kLnAHJrlEhHsqY=; b=h5NcLaY21K2HfNklp9iHm1/oeLB1mFKQ2y0P4Y5tI0zFVj58jWoR99qeQWZhbxwplN MZj4t0jYMTS0/4ORbcA2gkisgzF0X5GTSM7JpYPWWWx7c1C5bX9nK5RtgkvpqxqFK/zA blXT36v404jaq4s07hpCkgnQu4KlR/ILWbxeexyToYvNzOkUcVVuP77qW0DX8A808CSm W2f0GLLAYesjUB9FXPZVo9kFpJyAJH3OrXCZQnG9yAZ7KQgPc0XNhNmTDrn44hmjqzL3 MAqGmPibf1Exb1mR7podV/4c/WfqV0y1YOFjcJAwebmpKdCn8UTDxCOotP6JDdRolcpT UfLg== MIME-Version: 1.0 X-Received: by 10.52.35.17 with SMTP id d17mr23473548vdj.74.1373850120167; Sun, 14 Jul 2013 18:02:00 -0700 (PDT) In-Reply-To: References: Date: Sun, 14 Jul 2013 21:02:00 -0400 Subject: Re: Ideal way to separate GUI and logic? From: Joel Goldstick To: fronagzen@gmail.com Content-Type: multipart/alternative; boundary=20cf307cfc4063277c04e18268a8 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 74 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373850127 news.xs4all.nl 15881 [2001:888:2000:d::a6]:47961 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50653 --20cf307cfc4063277c04e18268a8 Content-Type: text/plain; charset=UTF-8 On Sun, Jul 14, 2013 at 8:25 PM, wrote: > Thanks for all the responses! > > So as a general idea, I should at the very least separate the GUI from the > program logic by defining the logic as a function, correct? And the next > level of separation is to define the logic as a class in one or more > separate files, and then import it to the file with the GUI, correct? > > My next question is, to what degree should I 'slice' my logic into > functions? How small or how large should one function be, as a rule of > thumb? > -- > http://mail.python.org/mailman/listinfo/python-list > Others may differ. I think you should just write the code. In actually doing that you will learn the pitfalls of how you have divided up your logic. Writing code isn't all theory. It takes practice, and since the days of The Mythical Man-Month, it has been well understood that you always end up throwing away the first system anyway. It has to be built to truly understand what you think you want to create, but in the learning, you realize that its easier and better to start more or less from scratch rather than try to fix the first concept. -- Joel Goldstick http://joelgoldstick.com --20cf307cfc4063277c04e18268a8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Sun, Jul 14, 2013 at 8:25 PM, <fronagzen@gmail.com> wrote:
Than= ks for all the responses!

So as a general idea, I should at the very least separate the GUI from the = program logic by defining the logic as a function, correct? And the next le= vel of separation is to define the logic as a class in one or more separate= files, and then import it to the file with the GUI, correct?

My next question is, to what degree should I 'slice' my logic into = functions? How small or how large should one function be, as a rule of thum= b?
--
http://mail.python.org/mailman/listinfo/python-list


Oth= ers may differ.=C2=A0 I think you should just write the code.=C2=A0 In actu= ally doing that you will learn the pitfalls of how you have divided up your= logic.=C2=A0 Writing code isn't all theory.=C2=A0 It takes practice, a= nd since the days of The Mythical Man-Month, it has been well understood th= at you always end up throwing away the first system anyway.=C2=A0 It has to= be built to truly understand what you think you want to create, but in the= learning, you realize that its easier and better to start more or less fro= m scratch rather than try to fix the first concept.



--
--20cf307cfc4063277c04e18268a8--