Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
Rugz007

HELLLPPPPPP!

Recommended Posts

pedro2555

Capitalization has the exact same purpose as does indentation. A friend of mine, while learning Ruby, once said to me: "It is everything you expect from a programming language, plain English, case sensitive and indent sensitive."

Indentation allows you to visually identify code structure, and capitalization has the same, overall, function, allows you to identify, for instance, the accessibility of a variable.

Microsoft suggests two capitalization schemes: PascalCase and camelCase. (And a 'special case' when using acronyms)

 

For instance, accessibility identification should use this scheme:

 

If you see something like:

Class.variable

You know that the underlying definition of variable is:

private object variable;

As opposed to:

Class.Variable

Which would be implemented as:

public object Variable;

One very common thing to have in C# is:

class MyClass{   public object[] MyArray;   private object myObject;   public object MyObject   {      get      {         return myObject;      }      set      {         myObject = value;      }   }   public MyClass(object[] myArray, object myObject)   {      MyArray = myArray;      this.myObject = myObject;   }}

Microsoft provides a comprehensive set of guidelines for .NET development in their Framework Design Guidelines -> http://msdn.microsoft.com/en-us/library/ms229042(v=vs.110).aspx

Edited by pedro2555

Share this post


Link to post
Share on other sites
LordOfTheBongs

i havent read through all of that link but i like to put underscore for private field referenced through public properties

 

i would write it as...

 

 

private object _myObject;public object MyObject{    get    {        return _myObject;    }    set    {        _myObject = value;    }}

 

because if i just saw myObject, i would assume it is not accessed in any way from other classes... while _myVar might be private but it still can be get or set from other classes

Share this post


Link to post
Share on other sites
Rugz007

Guys guys why dont u make a another topic?

Share this post


Link to post
Share on other sites
julionib

maybe its because im not a coder, i just kid with coding, for example, i never heard about that "camel case" that you said ^^


Guys guys why dont u make a another topic?

 

lol, ok i will stop ^^

Share this post


Link to post
Share on other sites
Rugz007

You are not a coder :O

Share this post


Link to post
Share on other sites
pedro2555

i havent read through all of that link but i like to put underscore for private field referenced through public properties

 

i would write it as...

private object _myObject;public object MyObject{    get    {        return _myObject;    }    set    {        _myObject = value;    }}

because if i just saw myObject, i would assume it is not accessed in any way from other classes... while _myVar might be private but it still can be get or set from other classes

 

Actually the usage of underscore is dis encouraged by Microsoft's Design Guidelines for .NET. Quoting them:

 

√ DO choose easily readable identifier names.

For example, a property named HorizontalAlignment is more English-readable than AlignmentHorizontal.

√ DO favor readability over brevity.

The property name CanScrollHorizontally is better than ScrollableX (an obscure reference to the X-axis).

X DO NOT use underscores, hyphens, or any other nonalphanumeric characters.

X DO NOT use Hungarian notation.

X AVOID using identifiers that conflict with keywords of widely used programming languages.

 

The scheme I've presented is the one suggested and used by Microsoft (and me :D), but that's up to you.

Edited by pedro2555

Share this post


Link to post
Share on other sites
NTAuthority

i believe u use the underscore for private fields refrenced through public properties

barely see a reason for not using automatic properties anyway

Share this post


Link to post
Share on other sites
LordOfTheBongs

 

i believe u use the underscore for private fields refrenced through public properties

barely see a reason for not using automatic properties anyway

 

well sometimes u need to wrap some extra code when setting or getting a value

 

 

private int myVal;public int MyVal{    set    {        OnMyValSet(EventArgs.Empty);        myVal = value;    }}

 

something like that

Edited by LordOfTheBongs

Share this post


Link to post
Share on other sites
NTAuthority

well sometimes u need to wrap some extra code when setting or getting a value

 

 

something like that

even though it's only an example I still feel the need to point out the Property Design section in the Member Design Guidelines stating the following:

 

X DO NOT provide set-only properties or properties with the setter having broader accessibility than the getter.

For example, do not use properties with a public setter and a protected getter.

If the property getter cannot be provided, implement the functionality as a method instead. Consider starting the method name with Set and follow with what you would have named the property. For example, AppDomain has a method called SetCachePath instead of having a set-only property called CachePath.

Edited by NTAuthority

Share this post


Link to post
Share on other sites
LordOfTheBongs

yeah it was just an example and i guess this would be better for a method... tbh i didnt even know that, it makes sense though.

Share this post


Link to post
Share on other sites
pedro2555

Guys guys why dont u make a another topic?

lol.

 

Why? Doesn't the discussion meet the topic title? I think it does.

Edited by pedro2555

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.