yes you can find my code here https://github.com/kilon/Nireas
On Sat, Dec 20, 2014 at 12:17 AM, Johan Fabry <jfa...@dcc.uchile.cl> wrote: > 36 methods for your UI is way too much. I suppose you are doing something > wrong somewhere. You should not need all of these steps. It should be: > > First you add the instance var (e.g. button) and accessors (BTW: Generate > the accessors. It’s 3 keystrokes and a click), otherwise the UI object > cannot reference its widgets. > > For 1) see my previous mail. The idea is to have 1 clear responsibility > per method, it’s good software engineering principles to do that. > > You don’t need to do 2) > > 3) if you don’t put a specific object inside the variable there is no way > for the system to know what kind of widget you want. > > 4) yes this makes sense :-) > > I do not understand what you mean with 5), sorry. I don’t do anything like > that. > > 6) you have to state where this button has to go, there is no way around > that. Class side is not so intuitive, OK. But at least all the layout is in > one place so we have 1 clear responsibility for each method. > > To summarize, there are 4 steps and none of them can really be omitted. > > I would like to have a look at your UI class so I can figure out what’s > going on. Can you tell me where to find it? > > > On Dec 19, 2014, at 16:54, kilon alios <kilon.al...@gmail.com> wrote: > > > > "Can you help me understand?" > > > > sure take this simple example I want to add a button for choosing > background color, I am giving you the list of my problems > > > > 1) If I want to initialise it I cant use the initialise method of my > class (why ? ) I have to use initializeWidgets > > > > 2) Inside initializeWidget I create an array that describes the name of > each button but no that is not enough > > > > 3) I have also have to initialise seperately the button with self > newButton but wait that is not enough > > > > 4) I have to define the action of the button the only step here that > makes sense to me but even that is not enough > > > > 5) I have to create a method that returns the name of the button and to > makes things even more verbose > > > > 6) I have to define a method at the class side for positioning the > button . No idea why this goes to the class side > > > > And all that so I can say to Spec take this button which has this label > and will trigger this method and put it in that place. Java Swing is not > that verbose. > > > > Generally I dont like this approach that I need to generate so many > method and so many steps to define something so simple. > > > > So what happens right now is that I have a very simple GUI with 7 > buttons and 6 moprh that i use to display colors , guess how many methods > my class has . > > > > 36 !!! > > > > By the way in case you wonder 90% of the code is just Spec. For me thats > plain unacceptable. > > > > So what happens if I have a GUI with over 100 buttons do I need 300 > methods just for Spec ? Really ?? > > > > ---> Save our in-boxes! http://emailcharter.org <--- > > Johan Fabry - http://pleiad.cl/~jfabry > PLEIAD lab - Computer Science Department (DCC) - University of Chile > > >