Future of refactorings

Andreas Pakulat apaku at gmx.de
Fri Jul 31 07:48:35 UTC 2015


Hi,

On Fri, Jul 31, 2015 at 12:53 AM, Sven Brauch <mail at svenbrauch.de> wrote:

> Hey!
>
> Here are some refactoring tools which come to my mind, apart from the
> obvious "rename stuff" tools:
>

In case you're indeed looking for ideas of refactoring tools (please excuse
me if some of those already exist):

- Move functions to other classes, including either updating all callers or
leaving the original variant as a forwarding function
- move functions up/down in the current class hierarchy (as a kind of
shortcut for the general move elsewhere)
- change function signatures, removing/adding arguments, changing their
type etc.
- Move nested classes to toplevel (i.e. class Foo { class Bar {}; };, move
Bar to a separate file)
- Extract a list of members of one class into a datastructure (i.e.
bundling logically close data into a ne strcture)
- Extract an interface from an existing class (i.e. create a base-class
with pure virtuals)
- Extract methods into a base-class
- Generate Getter/Setter's for members of a class
- When having written a class declaration that inherits from an interface
class automatically generate implementations for the pure virtual functions
- sort member functions and variables

Somewhat related to the above:

- when using a variable name without declaring it first provide a means to
setup either a local or a member variable of the 'right' type (if possible
to extract)
- same thing for functions including setting up the arguments and their
types

In case you're wondering: I just took a look at what Eclipse offers for its
Java support and took those that I know I've used at least twice in the
past (or those that I would've used multiple times if I would remember they
exist).

Some of those should also probably get keyboard shortcuts, things like
rename or move that are used very often.

Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20150731/e1ef4cda/attachment-0001.html>


More information about the KDevelop-devel mailing list