473,321 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

How to can I increase my code readability in C#

Hi Guys,
When I skim fast into my old code or others code, I
forget what the type of a certain variable was or what
its initialization value was.

We use the Hungarian notation and it helps to remember
what was the type (most of the times), but it dose not
help to know what was the initialization value. Even with
Hungarian notation some time the prefix gets the same for
deferent types.

Now VB.Net players use Dim Key word in the line that
contains the variable definition, and as long Dim is a
key word it appears in blue color and that helps a lot to
locate it very fast. I try to add /**/ just before each
variable, it helps a lot to locate the lines, but as long
it's not a language standard that has a lot of problems...

Although we have the "goto definition" in the IDE;
thanks Microsoft it helps a lot; it dose not help with
the locating the initialize value. Also "goto definition"
has a problem which I call it "Uncontrolled Move", I mean
you may jump far away from your code point and that lost
your focus of what you was reading to locating your code
point again....

If any body has an idea of how to solve these problems
please help.. or if any body know if there is a window
like the "Autos" window which we have in Debug time that
run in the design time....

Best Regards,
Osama Rajab

Nov 15 '05 #1
6 1959
I probably can't offer you much help, seeing as I don't even use the
type-identifying prefixes (like 'str' and 'int', etc.). I also don't find
my code (or anyone else's code written in the same manner) confusing either.
But I'm not one to criticize anyoneone's coding style, it's largely a
personal preference thing. One thing I can suggest is that you use
bookmarks to navigate through your code more efficiently. Before you use
'go to definition', just set a bookmark wherever you are, and with just one
click, you're back where you started. I have found that .NET's 'go to
definition' is less useful than VB6's ever was simply because I can mouse
over a variable name, and get most of the information I need right there.
It tells you the type, whether it's public or private, where it came from
(e.g. local variable, parameter, etc.). I don't know why the init value is
of interest, but I suppose some fancy comment next to where the variable is
initialized would be sufficient enough to quickly find it.

Chris LaJoie

"Osama Rajab" <Os*********@hotmail.com> wrote in message
news:13****************************@phx.gbl...
Hi Guys,
When I skim fast into my old code or others code, I
forget what the type of a certain variable was or what
its initialization value was.

We use the Hungarian notation and it helps to remember
what was the type (most of the times), but it dose not
help to know what was the initialization value. Even with
Hungarian notation some time the prefix gets the same for
deferent types.

Now VB.Net players use Dim Key word in the line that
contains the variable definition, and as long Dim is a
key word it appears in blue color and that helps a lot to
locate it very fast. I try to add /**/ just before each
variable, it helps a lot to locate the lines, but as long
it's not a language standard that has a lot of problems...

Although we have the "goto definition" in the IDE;
thanks Microsoft it helps a lot; it dose not help with
the locating the initialize value. Also "goto definition"
has a problem which I call it "Uncontrolled Move", I mean
you may jump far away from your code point and that lost
your focus of what you was reading to locating your code
point again....

If any body has an idea of how to solve these problems
please help.. or if any body know if there is a window
like the "Autos" window which we have in Debug time that
run in the design time....

Best Regards,
Osama Rajab

Nov 15 '05 #2
I probably can't offer you much help, seeing as I don't even use the
type-identifying prefixes (like 'str' and 'int', etc.). I also don't find
my code (or anyone else's code written in the same manner) confusing either.
But I'm not one to criticize anyoneone's coding style, it's largely a
personal preference thing. One thing I can suggest is that you use
bookmarks to navigate through your code more efficiently. Before you use
'go to definition', just set a bookmark wherever you are, and with just one
click, you're back where you started. I have found that .NET's 'go to
definition' is less useful than VB6's ever was simply because I can mouse
over a variable name, and get most of the information I need right there.
It tells you the type, whether it's public or private, where it came from
(e.g. local variable, parameter, etc.). I don't know why the init value is
of interest, but I suppose some fancy comment next to where the variable is
initialized would be sufficient enough to quickly find it.

Chris LaJoie

"Osama Rajab" <Os*********@hotmail.com> wrote in message
news:13****************************@phx.gbl...
Hi Guys,
When I skim fast into my old code or others code, I
forget what the type of a certain variable was or what
its initialization value was.

We use the Hungarian notation and it helps to remember
what was the type (most of the times), but it dose not
help to know what was the initialization value. Even with
Hungarian notation some time the prefix gets the same for
deferent types.

Now VB.Net players use Dim Key word in the line that
contains the variable definition, and as long Dim is a
key word it appears in blue color and that helps a lot to
locate it very fast. I try to add /**/ just before each
variable, it helps a lot to locate the lines, but as long
it's not a language standard that has a lot of problems...

Although we have the "goto definition" in the IDE;
thanks Microsoft it helps a lot; it dose not help with
the locating the initialize value. Also "goto definition"
has a problem which I call it "Uncontrolled Move", I mean
you may jump far away from your code point and that lost
your focus of what you was reading to locating your code
point again....

If any body has an idea of how to solve these problems
please help.. or if any body know if there is a window
like the "Autos" window which we have in Debug time that
run in the design time....

Best Regards,
Osama Rajab

Nov 15 '05 #3
Osama Rajab <Os*********@hotmail.com> wrote:
When I skim fast into my old code or others code, I
forget what the type of a certain variable was or what
its initialization value was.
So hover over the variable and you should find its type very quickly.
We use the Hungarian notation and it helps to remember
what was the type (most of the times)
Hovering is likely to be more accurate.
but it dose not
help to know what was the initialization value. Even with
Hungarian notation some time the prefix gets the same for
deferent types.
Which is why I don't use Hungarian... (well, one reason, anyway).
Now VB.Net players use Dim Key word in the line that
contains the variable definition, and as long Dim is a
key word it appears in blue color and that helps a lot to
locate it very fast. I try to add /**/ just before each
variable, it helps a lot to locate the lines, but as long
it's not a language standard that has a lot of problems...
If your methods are small enough, the local variable declarations
should be fairly obvious. Give XML documentation to non-local variables
and it should be easy enough to find them. You might also want to
Although we have the "goto definition" in the IDE;
thanks Microsoft it helps a lot
I just wish MS would implement the same system Eclipse has, where
holding down Ctrl makes variables (and method names etc) into links,
and clicking the link takes you to the definition - much easier than
going for a context menu etc. Other key modifiers can make the
hover/link do different things. It's a really nice feature.
it dose not help with
the locating the initialize value.
Only if you don't initialise the value at the declaration - and if you
don't, they could be initialised at any number of places. I'm not sure
what you want here...
Also "goto definition"
has a problem which I call it "Uncontrolled Move", I mean
you may jump far away from your code point and that lost
your focus of what you was reading to locating your code
point again....
That's what the "back" button is for though. It's the one next to the
"Redo" button, at least by default. Press Ctrl and Minus at the same
time and you should get the same effect too.
If any body has an idea of how to solve these problems
please help.. or if any body know if there is a window
like the "Autos" window which we have in Debug time that
run in the design time....


I can't say it's something that's ever bothered me. If you know the
initialisation value in advance, put it in with the declaration. If
not, I don't see how the IDE could work it out. You can always write
something in the XML documentation, and that will pop up when you hover
over the variable name.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #4
Osama Rajab <Os*********@hotmail.com> wrote:
When I skim fast into my old code or others code, I
forget what the type of a certain variable was or what
its initialization value was.
So hover over the variable and you should find its type very quickly.
We use the Hungarian notation and it helps to remember
what was the type (most of the times)
Hovering is likely to be more accurate.
but it dose not
help to know what was the initialization value. Even with
Hungarian notation some time the prefix gets the same for
deferent types.
Which is why I don't use Hungarian... (well, one reason, anyway).
Now VB.Net players use Dim Key word in the line that
contains the variable definition, and as long Dim is a
key word it appears in blue color and that helps a lot to
locate it very fast. I try to add /**/ just before each
variable, it helps a lot to locate the lines, but as long
it's not a language standard that has a lot of problems...
If your methods are small enough, the local variable declarations
should be fairly obvious. Give XML documentation to non-local variables
and it should be easy enough to find them. You might also want to
Although we have the "goto definition" in the IDE;
thanks Microsoft it helps a lot
I just wish MS would implement the same system Eclipse has, where
holding down Ctrl makes variables (and method names etc) into links,
and clicking the link takes you to the definition - much easier than
going for a context menu etc. Other key modifiers can make the
hover/link do different things. It's a really nice feature.
it dose not help with
the locating the initialize value.
Only if you don't initialise the value at the declaration - and if you
don't, they could be initialised at any number of places. I'm not sure
what you want here...
Also "goto definition"
has a problem which I call it "Uncontrolled Move", I mean
you may jump far away from your code point and that lost
your focus of what you was reading to locating your code
point again....
That's what the "back" button is for though. It's the one next to the
"Redo" button, at least by default. Press Ctrl and Minus at the same
time and you should get the same effect too.
If any body has an idea of how to solve these problems
please help.. or if any body know if there is a window
like the "Autos" window which we have in Debug time that
run in the design time....


I can't say it's something that's ever bothered me. If you know the
initialisation value in advance, put it in with the declaration. If
not, I don't see how the IDE could work it out. You can always write
something in the XML documentation, and that will pop up when you hover
over the variable name.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #5
Hi John,
Hovering is likely to be more accurate.
Can you please explain to me the Hover method or send me any link about it...
should be fairly obvious. Give XML documentation to non- local variables
I don't know XML documentation ,can you help ???
Only if you don't initialise the value at the declaration - and if youdon't, they could be initialised at any number of places. I'm not surewhat you want here... The point is, the variable could be initialized at any point other than the declaration line, so locating the
initialization line some times defficult. I want to
remind you that the code I read dose not belong to me or
some one in my team.

Osama Rajab-----Original Message-----
Osama Rajab <Os*********@hotmail.com> wrote:
When I skim fast into my old code or others code, I
forget what the type of a certain variable was or what
its initialization value was.
So hover over the variable and you should find its type

very quickly.
We use the Hungarian notation and it helps to
remember what was the type (most of the times)


Hovering is likely to be more accurate.
but it dose not
help to know what was the initialization value. Even with Hungarian notation some time the prefix gets the same for deferent types.


Which is why I don't use Hungarian... (well, one reason,

anyway).
Now VB.Net players use Dim Key word in the line that
contains the variable definition, and as long Dim is a
key word it appears in blue color and that helps a lot to locate it very fast. I try to add /**/ just before each variable, it helps a lot to locate the lines, but as long it's not a language standard that has a lot of problems...

If your methods are small enough, the local variable declarationsshould be fairly obvious. Give XML documentation to non- local variablesand it should be easy enough to find them. You might also want to
Although we have the "goto definition" in the IDE;
thanks Microsoft it helps a lot
I just wish MS would implement the same system Eclipse

has, whereholding down Ctrl makes variables (and method names etc) into links,and clicking the link takes you to the definition - much easier thangoing for a context menu etc. Other key modifiers can make thehover/link do different things. It's a really nice feature.
it dose not help with
the locating the initialize value.
Only if you don't initialise the value at the

declaration - and if youdon't, they could be initialised at any number of places. I'm not surewhat you want here...
Also "goto definition"
has a problem which I call it "Uncontrolled Move", I
mean you may jump far away from your code point and that lost your focus of what you was reading to locating your code point again....


That's what the "back" button is for though. It's the

one next to the"Redo" button, at least by default. Press Ctrl and Minus at the sametime and you should get the same effect too.
If any body has an idea of how to solve these problems
please help.. or if any body know if there is a window
like the "Autos" window which we have in Debug time that run in the design time....
I can't say it's something that's ever bothered me. If

you know theinitialisation value in advance, put it in with the declaration. Ifnot, I don't see how the IDE could work it out. You can always writesomething in the XML documentation, and that will pop up when you hoverover the variable name.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.

Nov 15 '05 #6
[Post reformatted for readability]

Osama Rajab <Os*********@hotmail.com> wrote:
Hovering is likely to be more accurate.
Can you please explain to me the Hover method or send
me any link about it...


Just hover your pointer over a variable name. You'll see its type and
any documentation you've written for it.
should be fairly obvious. Give XML documentation to non-
local variables


I don't know XML documentation ,can you help ???


Look up "XML documentation" in MSDN - if you're not using it, then
becoming aware of it and using it extensively is the first step towards
greater readability, IMO.
Only if you don't initialise the value at the
declaration - and if you don't, they could be initialised
at any number of places. I'm not sure what you want here...


The point is, the variable could be initialized at any
point other than the declaration line, so locating the
initialization line some times defficult.


Right. That sounds like you want the "usage" search in Eclipse, which
shows when fields are read/written/declared. Unfortunately I don't know
of anything similar in VS.NET :(

(Note that a write doesn't necessarily mean initialisation - it could
be reassignment.)
I want to
remind you that the code I read dose not belong to me or
some one in my team.


Ah... that certainly makes things harder.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
3
by: srijit | last post by:
Hello, Here is an example code of xml writer in Python+PythonNet, Ironpython and Boo. The codes look very similar. Regards, Srijit Python + PythonNet: import CLR
52
by: entropy123 | last post by:
Hey all, I'm working with some legacy C code and I would like to compile it as a CPP file. I get the following error message: driver.cpp:87: cannot convert `void *' to `GenericStruct *' in...
0
by: Osama Rajab | last post by:
Hi Guys, When I skim fast into my old code or others code, I forget what the type of a certain variable was or what its initialization value was. We use the Hungarian notation and it helps to...
5
by: Dan | last post by:
I wonder if anyone has suggestions for reducing the amount of time it would take to search my array using the function that I have written. I want to find a position in the array of an item that...
11
by: eomer | last post by:
My site is very small, and plain - it will mostly be text (for now). I have used a good mix of css in the design. With usability in mind I would like to add some specific functionality (with the...
48
by: Tony | last post by:
How much bloat does the STL produce? Is it a good design wrt code bloat? Do implementations vary much? Tony
4
by: =?Utf-8?B?c2FtZWVy?= | last post by:
environment : .net framework 1.1, ado.net, visual studio 2003, vb, sqlsever 2000, winforms, webforms I want to increase the timout of the webservice in the application which is being used in a...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.