This site requires JavaScript, please enable it in your browser!
Greenfoot back
Builderboy2005
Builderboy2005 wrote ...

2012/2/1

Method Minimizing

Builderboy2005 Builderboy2005

2012/2/1

#
I noticed in several other IDE's such as eclipse, there are little minus symbols next to each method that allows you to minimize that method's code into a single line, only showing the method name. This seems like it could be a useful feature to implement into the Greenfoot editor, and could help code visibility when there are large numbers of methods, or methods with large amounts of code.
sp33dy sp33dy

2012/2/1

#
I like this idea, but also have a point against it. There is a good argument for leaving as-is because a method should never be more than a page long. Almost all methods longer than that should be refactored to ensure it is short, concise and broken into reusable methods or further classes. This may sound 'idealistic', but I've found through experience that it is true. On the subject of desired function. I'd simply like a rename Class option when I right click a class. I tend to create classes and then shuffle them around. At the moment I have to create a new class and cut'n'paste code across. It'd be lovely to have a rename function..
Builderboy2005 Builderboy2005

2012/2/1

#
You can rename a class simply by changing the name of the class in the text. As for the method minimizing, I disagree that all methods should be 1 page or less. I myself have thousands of lines of code in my world class for Nightmare, splitting all of the large methods into smaller ones wouldn't increase visibility but instead make it harder to find the piece of code I'm looking for.
sp33dy sp33dy

2012/2/1

#
That's a really useful tip, regarding the renaming. Coming from an Eclipse background, if you tried that, the compiler would go mad as the filename would remain unchanged! Neat that the Greenfoot tool does the file change too! It'd still be nice to be able to click on the class on the right and be allowed to do a rename; however, thanks! You've save me some frustration there. As for the your point about method length. There are occasionally times when rules are supposed to be broken. However, often taking time to look at why code is so long and refactoring makes everything both neater and quicker. There are a couple of very good books out there illustrating such points. However, this is a personal opinion and preference and you are more than welcome to disagree! That's why its important to listen, understand and make your own opinion. I think I have to accept each others points. I'd must poke around the nightmare code soon! Which again, is truly remarkable, in terms of atmosphere.
Morran Morran

2012/2/1

#
I think that method minimizing would be a great addition.
darkmist255 darkmist255

2012/2/1

#
Depending on what licenses let people do, Notepad++ has this minimizing sections feature and it's open source. If anyone takes a look through the source they might get a good prototype.
You need to login to post a reply.