473,811 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "Uncontroll ed 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 1996
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*********@ho tmail.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 "Uncontroll ed 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*********@ho tmail.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 "Uncontroll ed 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*********@ho tmail.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 "Uncontroll ed 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.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #4
Osama Rajab <Os*********@ho tmail.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 "Uncontroll ed 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.co m>
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*********@ho tmail.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 "Uncontroll ed 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 theinitialisati on 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.co m>
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*********@ho tmail.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.co m>
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
34295
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 capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
3
2937
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
6830
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 assignment
0
259
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 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.
5
1517
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 matches on all three variables. Suggestions? Public Shared Function GetArrayPosition(ByVal ipRemoteEndPoint As String, ByVal intEngine_Type As Integer, ByVal intEngine_ID As Integer) For i As Integer = 0 To aryDevice.GetUpperBound(1) If...
11
5398
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 vision impaired in mind). I would like to allow the user/reader of the web site the ability to select another font size, say from a drop downbox. This would increase the size of any text between paragraph tags, or in table data tags. This...
48
2652
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
58471
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 huge number of places and this woudl take me forever if i do it indivisually, is there any way i can increase the timeout globally by something like specifying in the config file? thanks sameer
30
3555
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
9728
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10402
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.