Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: bilsch Newsgroups: comp.lang.java.programmer Subject: Re: I need a different approach - suggestions please Date: Fri, 29 Jun 2012 13:07:24 -0700 Organization: A noiseless patient Spider Lines: 40 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 29 Jun 2012 20:07:23 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="SCMsXqyEgNCKlTC+UnaBHg"; logging-data="5049"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18SbepGRtUmVC1h+TAcDprh" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: Cancel-Lock: sha1:3UjGpEaafp9GkkVqRz6BatjrAsY= Xref: csiph.com comp.lang.java.programmer:15751 On 6/29/2012 8:12 AM, Patricia Shanahan wrote: > On 6/25/2012 3:31 PM, bilsch wrote: >> I'm trying to make a program that works like the calculator in Windows >> Accessories - all input is from button clicks. Below I listed a >> stripped down version of the GUI and a little of the processing behind >> it. It is in two small files. I had intended that the program would >> display a sequence of digits from button clicks, which I would then >> convert into a Double precision number. The problem is I am constrained >> to initialize the string within the method that accumulates the sequence >> of digits. Everytime the method is called the string is reinitialized >> with the result that my sequence of digits is only ever one digit long. >> My plan would work if I could initialize the string outside the method, >> however variable scope in Java doesn't allow it. > ... > > I'm going back to the base article, to suggest a basically different > approach. > > During my spare time over the last couple of weeks I've been studying an > unfamiliar C++ graphics library. I realized that my normal approach to > learning languages and libraries was entirely different from yours. > > I wrote a series of very simple, small programs, each of which > introduced only one new technique. For example, my program for learning > to connect a button to the code that should run when it is clicked > created a window containing one button, and wrote "hello" to standard > out each time it was clicked. When that was working I advanced to two > buttons doing different things. > > Each learning program incorporated at most one new technique. The > programs I was really trying to write did not use any new graphics > techniques - I had tried everything out in smaller programs. > > Have you considered a step-by-step approach, as an alternative to > writing an application and then trying to make it work? > > Patricia Yes, I do generally use a stepwise approach. I appreciate the value of that.