22 comments
Comment actions Permalink

Currently, the redundant "this." prefix is removed if the "shorten
references" option is checked. I think it too complicated to have the
separate option for every case

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Carsten Jendro" <no_mail@jetbrains.com> wrote in message
news:26744132.1124200371785.JavaMail.itn@is.intellij.net...

R

  1. build 204 removes "this" keyword on reformat code.

>

The feature request #5367 says:

>

"Please add an option to remove this"

>

Where can i find this option?

>

See also:

>

http://www.intellij.net/tracker/resharper/viewSCR?publicId=5367
http://www.intellij.net/tracker/resharper/viewSCR?publicId=8033
http://www.intellij.net/tracker/resharper/viewSCR?publicId=5899



0
Comment actions Permalink

Yes i know, but i think some people like to use "Shorten References" without deleting all "this" keywords.

I think adding code style options for "this" and "base" keywords (Add, Remove and No change) would be the best way to handle this to the satisfaction of all users.

0
Comment actions Permalink

Yes i know, but i think some people like to use "Shorten References"
without deleting all "this" keywords.


Why? It is only removed when it's completely unnecessary and redundant.
There's just no point in having it there.

I think adding code style options for "this" and "base" keywords (Add,
Remove and No change) would be the best way to handle this to the
satisfaction of all users.


If it's redundant, it serves no purpose, so why have it there? Why would
you want to keep it there? Just because you like extra unnecessary typing
and reading? I don't understand. (and I find code with redudnant usage of
'this' to be very annoying to read) I'm genuinely curious as to the source
of the resistence to just getting ride of redundant 'this' usages...



0
Comment actions Permalink

Sometimes it has some values to help distinguish between field variables and method variables

0
Comment actions Permalink

"Nat" <no_mail@jetbrains.com> wrote in message
news:18421462.1124241605262.JavaMail.itn@is.intellij.net...

Sometimes it has some values to help distinguish between field variables
and method variables


I agree. Especially in reading code written by others, and even codes
written by myself sometimes ago.
I still remember those naming conventions that use things like mintXXX,
gintYYY to distinguish a module level variable etc. this.xxx and base.yyy is
basically serving the same purpose.

My 1 cent worth.

Best Regards


0
Comment actions Permalink

Nat wrote:

Sometimes it has some values to help distinguish between field variables and method variables


Agreed, the same as it isn't necessary to use the 'private' modifier, it
does make it more clear.

I'd rather have an option 'extend references' that places 'this.' for
each field/property reference, even though it's redundant...

+2cts Wiebe

0
Comment actions Permalink

Hi Paul,

Why? It is only removed when it's completely unnecessary and redundant.
There's just no point in having it there.


Yes, thats correct, especially when you have R# with syntax coloring for local and member variables.

But in the company i work, only the pure C# developers have a R# license.

Our C++ Coders sometimes opens C# projects for bugfixing or code review, it is mutch easyer for them to read the code when there are "this" and "base" keywords.
So we have decided to use this and base keywords every time in the projects that are shared between our C++ und C# developers

I am shure that there are many other companys with coding conventions where these keywords are forced.

If it's redundant, it serves no purpose, so why have it there?
Why would you want to keep it there?
Just because you like extra unnecessary typing and reading?


Looking from your perspective you are absolutly right, but i thing R# is developed to meet the demands for the maximun count of users as possible.

0
Comment actions Permalink

The company I'm currently contracted to at uses the "this." and "base." modifiers for all member fields. This prevents the use of naming guidelines like adding _ or adding a 'm', 'l' whatever prefix to every member.

It would be nice if in the code formatting options we could configure the use of the "this." prefix. Shorten references should adhere to this setting.

0
Comment actions Permalink

"Nat" <no_mail@jetbrains.com> wrote in message
news:18421462.1124241605262.JavaMail.itn@is.intellij.net...

>> Sometimes it has some values to help distinguish between field
>> variables and method variables
>>

I agree. Especially in reading code written by others, and even codes
written by myself sometimes ago.
I still remember those naming conventions that use things like
mintXXX,
gintYYY to distinguish a module level variable etc. this.xxx and
base.yyy is
basically serving the same purpose.
My 1 cent worth.


I agree: this and base does add to the readability of the code.

---
Med venlig hilsen,
Søren Lund
www.publicvoid.dk


0
Comment actions Permalink

Thank you all for the discussion.
We will implement the option for "this." modifier.

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Carsten Jendro" <no_mail@jetbrains.com> wrote in message
news:26744132.1124200371785.JavaMail.itn@is.intellij.net...

R

  1. build 204 removes "this" keyword on reformat code.

>

The feature request #5367 says:

>

"Please add an option to remove this"

>

Where can i find this option?

>

See also:

>

http://www.intellij.net/tracker/resharper/viewSCR?publicId=5367
http://www.intellij.net/tracker/resharper/viewSCR?publicId=8033
http://www.intellij.net/tracker/resharper/viewSCR?publicId=5899



0
Comment actions Permalink

And when it's only cut & paste do the same for "base." ;)

0
Comment actions Permalink

to avoid next discusion...

0
Comment actions Permalink

Why aren't you using the Resharper coloring for that? You can set the
individual colors (and bold) for local variables, parameters, fields, static
fields, events, etc. all separately. And you should. It makes reading the
code much, much easier.

"Nat" <no_mail@jetbrains.com> wrote in message
news:18421462.1124241605262.JavaMail.itn@is.intellij.net...

Sometimes it has some values to help distinguish between field variables
and method variables



0
Comment actions Permalink

I disagree. It detracts from the readability by making the code verbose and
redundant.

Use the syntax coloring if you need to distinguish between local and field
variables. It's much easier on the eyes.

"Søren Lund" <public@publicvoid.dk> wrote in message
news:bacdf58c936b8c77138fd363c93@news.jetbrains.com...
>> "Nat" <no_mail@jetbrains.com> wrote in message
>> news:18421462.1124241605262.JavaMail.itn@is.intellij.net...
>>
>>> Sometimes it has some values to help distinguish between field
>>> variables and method variables
>>>
>> I agree. Especially in reading code written by others, and even codes
>> written by myself sometimes ago.
>> I still remember those naming conventions that use things like
>> mintXXX,
>> gintYYY to distinguish a module level variable etc. this.xxx and
>> base.yyy is
>> basically serving the same purpose.
>> My 1 cent worth.
>

I agree: this and base does add to the readability of the code.

>

---
Med venlig hilsen,
Søren Lund
www.publicvoid.dk

>



0
Comment actions Permalink

To further what Paul is saying, not only is this redundant but so are
line feeds, and anything more than one space. Please force all users of
R# to have their code formated as one long line with only one space
between each token.

Paul Bradshaw wrote:

I disagree. It detracts from the readability by making the code verbose and
redundant.

Use the syntax coloring if you need to distinguish between local and field
variables. It's much easier on the eyes.

"Søren Lund" <public@publicvoid.dk> wrote in message
news:bacdf58c936b8c77138fd363c93@news.jetbrains.com...

>>>"Nat" <no_mail@jetbrains.com> wrote in message
>>>news:18421462.1124241605262.JavaMail.itn@is.intellij.net...
>>>
>>>
>>>>Sometimes it has some values to help distinguish between field
>>>>variables and method variables
>>>>
>>>
>>>I agree. Especially in reading code written by others, and even codes
>>>written by myself sometimes ago.
>>>I still remember those naming conventions that use things like
>>>mintXXX,
>>>gintYYY to distinguish a module level variable etc. this.xxx and
>>>base.yyy is
>>>basically serving the same purpose.
>>>My 1 cent worth.
>>
>>I agree: this and base does add to the readability of the code.
>>
>>---
>>Med venlig hilsen,
>>Søren Lund
>>www.publicvoid.dk
>>
>>


0
Comment actions Permalink

Hardly. Whitespace makes things readable. To me, constantly using "this."
everywhere makes code very ugly and unreadable.

And so far the only justification for doing that is to be able to
distinguish identifiers that are local from those that are fields... and
color coding does that just fine.

I just want to strongly encourage the feature of removing all redundant
"this." usages as a default feature. Such an abuse of "this." really should
be kept to a minimum, imho.


"Alan Schrank" <schrank.alan@systememiths.net> wrote in message
news:de03pn$gj2$1@is.intellij.net...

To further what Paul is saying, not only is this redundant but so are line
feeds, and anything more than one space. Please force all users of R# to
have their code formated as one long line with only one space between each
token.

>

Paul Bradshaw wrote:

>> I disagree. It detracts from the readability by making the code verbose
>> and redundant.
>>
>> Use the syntax coloring if you need to distinguish between local and
>> field variables. It's much easier on the eyes.
>>
>> "Søren Lund" <public@publicvoid.dk> wrote in message
>> news:bacdf58c936b8c77138fd363c93@news.jetbrains.com...
>>
>>>>"Nat" <no_mail@jetbrains.com> wrote in message
>>>>news:18421462.1124241605262.JavaMail.itn@is.intellij.net...
>>>>
>>>>
>>>>>Sometimes it has some values to help distinguish between field
>>>>>variables and method variables
>>>>>
>>>>
>>>>I agree. Especially in reading code written by others, and even codes
>>>>written by myself sometimes ago.
>>>>I still remember those naming conventions that use things like
>>>>mintXXX,
>>>>gintYYY to distinguish a module level variable etc. this.xxx and
>>>>base.yyy is
>>>>basically serving the same purpose.
>>>>My 1 cent worth.
>>>
>>>I agree: this and base does add to the readability of the code.
>>>
>>>---
>>>Med venlig hilsen,
>>>Søren Lund
>>>www.publicvoid.dk
>>>
>>>
>>
>>

0
Comment actions Permalink

Hello Carsten,

From that view then the 'inverse' option should also be available - for R#
to force this. and base. should it not?

That way R# is most useful as a formatting tool - in fact then one would
want to reformat the code 'as it is opened' and maybe one could then have
individual settings for each developer on a project. Add to that a 'format
on close' option with a whole different set of options and the files can
be stored in one standard (good for source control) and viewed/edited by
multiple users in any format each one wants.

Ronnie

Hi Paul,

>> Why? It is only removed when it's completely unnecessary and
>> redundant. There's just no point in having it there.
>>

Yes, thats correct, especially when you have R# with syntax coloring
for local and member variables.

But in the company i work, only the pure C# developers have a R#
license.

Our C++ Coders sometimes opens C# projects for bugfixing or code
review, it is mutch easyer for them to read the code when there are
"this" and "base" keywords. So we have decided to use this and base
keywords every time in the projects that are shared between our C++
und C# developers

I am shure that there are many other companys with coding conventions
where these keywords are forced.

>> If it's redundant, it serves no purpose, so why have it there? Why
>> would you want to keep it there? Just because you like extra
>> unnecessary typing and reading?
>>

Looking from your perspective you are absolutly right, but i thing R#
is developed to meet the demands for the maximun count of users as
possible.



0
Comment actions Permalink

I use r# coloring and i like it very mutch, but not all programmers in my company have resharper installed.

0
Comment actions Permalink

I disagree. It detracts from the readability by
making the code verbose and
redundant.

Use the syntax coloring if you need to distinguish
between local and field
variables. It's much easier on the eyes.


Not everybody uses a text editor that can distinguish between these and sometimes you'll have to look at code emailed or partial snippets in documentation. In those cases these keywords remain, but syntax highlighting doesn't.

When tryign to solve problems ona production environment you'll also have to open files in notepad once in a while, and there too do these things help. Installing VS2003 & resharper on a production environment would not be my choice ;)

0
Comment actions Permalink

Hello Carsten,

From that view then the 'inverse' option should also
be available - for R#
to force this. and base. should it not?

That way R# is most useful as a formatting tool - in
fact then one would
want to reformat the code 'as it is opened' and maybe
one could then have
individual settings for each developer on a project.
Add to that a 'format
on close' option with a whole different set of
options and the files can
be stored in one standard (good for source control)
and viewed/edited by
multiple users in any format each one wants.


Combine that with source control and ou'll create a version/patch/diff/conflict/hell/etc....

Jesse

0
Comment actions Permalink

Hi Ronnie,

From that view then the 'inverse' option should also be available - for R#
to force this. and base. should it not?


click at the links at the top of this thread an you will find a feature request:

>>A New Code Style Option: Use Explicit this modifier
>>
>>[Always use this keyword]
>>[Use this only if needed]
>>[Do not change]

0

Please sign in to leave a comment.