473,396 Members | 2,050 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,396 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 1960
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
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.