Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Naming stuff...

Naming stuff...

Scheduled Pinned Locked Moved The Lounge
csharpjavascriptsysadmindatabasesql-server
38 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Munchies_Matt

    I usually use swear words for naming things. It makes coding so much more amusing. :)

    H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #12

    I've done that so many times unintentionally. I also get function names like ExpandRights, which sounds quite libertarian as code goes. That one gave me a chuckle. Also Explode, which totally makes sense once you understand it. I've used the local decl "sex" more often than i care to admit, usually in exception handlers

    When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

    1 Reply Last reply
    0
    • Sander RosselS Sander Rossel

      The everlasting struggle of developers and naming stuff... I'm not quite happy with my current project names (they're a bit longish, Company.Domain.Project.Data, for example), but what's bothering me even more at the moment is my own naming convention in Azure. I prefer PascalCased, like ThisIsMyWebApp, which is fine, except for other resources, like a SQL Server, which only allows lower characters. Long story short, I now have: MyWebApp my-sql-server mystorageaccount I'm now leaning more towards my-sql-server style for everything unless -'s are not possible, like with storage accounts. If this is what I'm worrying about everything must go pretty well, and it does, but this kind of stuff bothers me more than it should :~

      Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

      M Offline
      M Offline
      Member 9167057
      wrote on last edited by
      #13

      For project names, I go with proper titles. NotEvenPascalCase, I use my spacebar. Which a Cygwin-wielding co-worker of mine seriously dislikes as spaces are apparently impossible to process with bash scripts. Well, sucks for him, sucks for bash, my PSH-scripts work with that stuff just fine. I dare to say that I don't shy away from non-ASCII characters either. We're in Germany here (so non-ASCII characters are a thing), we don't outsource work to other sites. Meaning that I keep all my stuff in Uuncode and don't bother about keeping it ASCII which again brings the blood of some co-workers to boil. Especially those who learned their craft half a century ago and couldn't be bothered keeping up to the field during all those years.

      Sander RosselS 1 Reply Last reply
      0
      • H honey the codewitch

        I typically use underscores as lead ins for private members in .NET classes and structs. such as

        bool _foo;
        int _bar;

        The reason being is because .NET/C# will not let you declare two members of the same name at different protection levels. Leading with an underscore prevents naming conflicts with protected, public or internal members used in derived classes. Other than that, I feel the same way you do about them. The other exception is when i'm working in an environment where everything is named like that. When in Rome...

        When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

        Sander RosselS Offline
        Sander RosselS Offline
        Sander Rossel
        wrote on last edited by
        #14

        I used to do that until Visual Studio stopped generating fields with underscores. So now I just use this if I have the same name for a field and a local variable.

        Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

        H 1 Reply Last reply
        0
        • Sander RosselS Sander Rossel

          I used to do that until Visual Studio stopped generating fields with underscores. So now I just use this if I have the same name for a field and a local variable.

          Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

          H Offline
          H Offline
          honey the codewitch
          wrote on last edited by
          #15

          i didn't think it even let you declare them. maybe i'm wrong. i'm just going by how they're implemented in the IL. The actual fieldnames are what are present in the metadata along with a simple flag that gives you the protection level, so there is no space for two items with the same name. I don't know if I've ever tried it in C#, but *if* it works, it would have to munge the name in IL, which can create a few problems regarding reflection and such but only in narrow circumstances.

          When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

          Sander RosselS 1 Reply Last reply
          0
          • M Member 9167057

            For project names, I go with proper titles. NotEvenPascalCase, I use my spacebar. Which a Cygwin-wielding co-worker of mine seriously dislikes as spaces are apparently impossible to process with bash scripts. Well, sucks for him, sucks for bash, my PSH-scripts work with that stuff just fine. I dare to say that I don't shy away from non-ASCII characters either. We're in Germany here (so non-ASCII characters are a thing), we don't outsource work to other sites. Meaning that I keep all my stuff in Uuncode and don't bother about keeping it ASCII which again brings the blood of some co-workers to boil. Especially those who learned their craft half a century ago and couldn't be bothered keeping up to the field during all those years.

            Sander RosselS Offline
            Sander RosselS Offline
            Sander Rossel
            wrote on last edited by
            #16

            Wow, that seems very impractical... I've also never seen it before. The person who is going to have to maintain this after you will curse you. And if your co-workers can't work with it either you should probably change your style. Programming is a team sport and you can't just make up your own rules. Even for me (a Dutch neighbor) typing öüï etc. takes two extra key strokes, and I can't do a ß at all. Just because you can doesn't mean you should. So I can't say I disagree with your coworkers and I learned programming this decade :^)

            Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

            M 1 Reply Last reply
            0
            • Sander RosselS Sander Rossel

              Wow, that seems very impractical... I've also never seen it before. The person who is going to have to maintain this after you will curse you. And if your co-workers can't work with it either you should probably change your style. Programming is a team sport and you can't just make up your own rules. Even for me (a Dutch neighbor) typing öüï etc. takes two extra key strokes, and I can't do a ß at all. Just because you can doesn't mean you should. So I can't say I disagree with your coworkers and I learned programming this decade :^)

              Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

              M Offline
              M Offline
              Member 9167057
              wrote on last edited by
              #17

              Define "impractical". I claim that sticking to lessons half a century old is impractical. In certain cases, such as insistence on building linked lists by hand and freeing them, again by hand, in a different module instead of relying on C++'s standard containers, there's objectively measurable impact on productivity as this stuff is possible to get wrong thus development time gets wasted on fixing a homegrown solution instead of using a standard one. You're right thought that IF I outsourced my work to, let's say, you, things would get very impractical very quick. But you've ignored the part of my post where I said explicitly that the code stays in Germany. The only kind of people to curse me when I quit the company (which isn't going to happen anytime soon), are the kind of people stuck in the 60s. Or 80s, as for me. The kind of people who love short method names (because proccusl is totally more readable than ProcessCustomerList), who love doing stuff by themselves that the compiler does better (see example above) and sure, the kind of people who still live in the DOS age. Those will hate me. I live in a place with heating, water and electricity, shunning manual labor to have firewood in winter and having to go to a literal outhouse to take a dump (which is very fun in winter, trust me, I grew up in Russia and there's enough rural areas). It's time to accept that computing has moved on as well. It's time for my co-workers (well, I don't really care that much about them, but same goes for my successor) to stop living in the stone age. Edit: Excuse me, I forgot to mention another important part to that discussion. German (or Dutch) umlauts aren't the only use for Unicode. Even if I was typing all my names in pure English, that wouldn't help with physical units. You see, you can stylize volume units as m^3 which is even somewhat wide'ish recognized, a m³ is way simpler and easier to understand. That ³, in case you wonder, isn't part of ASCII so it's either ANSI code pages (please don't get me started on this nightmare) or a Unicode literal. Well, git can deal with Unicode just fine, it doesn't know how to output it on it's CLI returning raw bytes but it can tuck away and retrieve UTF8 code files just fine. Of course I could refer this to some internationalizing framework (which I have and which again runs in Unicode), but m³ is the same all over the world, introducing a layer of indirection there is pointless. It should go without saying of course that the IDE and it's compiler understand UTF8 just fine as

              Sander RosselS 1 Reply Last reply
              0
              • H honey the codewitch

                i didn't think it even let you declare them. maybe i'm wrong. i'm just going by how they're implemented in the IL. The actual fieldnames are what are present in the metadata along with a simple flag that gives you the protection level, so there is no space for two items with the same name. I don't know if I've ever tried it in C#, but *if* it works, it would have to munge the name in IL, which can create a few problems regarding reflection and such but only in narrow circumstances.

                When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                Sander RosselS Offline
                Sander RosselS Offline
                Sander Rossel
                wrote on last edited by
                #18

                Works fine in both C# and IL.

                public class Whatever
                private readonly string someValue;

                public Whatever(string someValue)
                {
                    this.someValue = someValue;
                }
                

                }

                ILDASM gives the following members (or whatever they are): .class public auto ansi beforefieldinit someValue : private initonly string .ctor : void(string) IL of ctor:

                .method public hidebysig specialname rtspecialname
                instance void .ctor(string someValue) cil managed
                {
                // Code size 16 (0x10)
                .maxstack 8
                IL_0000: ldarg.0
                IL_0001: call instance void [System.Runtime]System.Object::.ctor()
                IL_0006: nop
                IL_0007: nop
                IL_0008: ldarg.0
                IL_0009: ldarg.1
                IL_000a: stfld string ConsoleApp1.Whatever::someValue
                IL_000f: ret
                } // end of method Whatever::.ctor

                this.someValue is just different from someValue and by using the full namespace or whatever they can easily be kept apart :) Just like you can have the same class name in multiple namespaces :)

                Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                H 1 Reply Last reply
                0
                • M Member 9167057

                  Define "impractical". I claim that sticking to lessons half a century old is impractical. In certain cases, such as insistence on building linked lists by hand and freeing them, again by hand, in a different module instead of relying on C++'s standard containers, there's objectively measurable impact on productivity as this stuff is possible to get wrong thus development time gets wasted on fixing a homegrown solution instead of using a standard one. You're right thought that IF I outsourced my work to, let's say, you, things would get very impractical very quick. But you've ignored the part of my post where I said explicitly that the code stays in Germany. The only kind of people to curse me when I quit the company (which isn't going to happen anytime soon), are the kind of people stuck in the 60s. Or 80s, as for me. The kind of people who love short method names (because proccusl is totally more readable than ProcessCustomerList), who love doing stuff by themselves that the compiler does better (see example above) and sure, the kind of people who still live in the DOS age. Those will hate me. I live in a place with heating, water and electricity, shunning manual labor to have firewood in winter and having to go to a literal outhouse to take a dump (which is very fun in winter, trust me, I grew up in Russia and there's enough rural areas). It's time to accept that computing has moved on as well. It's time for my co-workers (well, I don't really care that much about them, but same goes for my successor) to stop living in the stone age. Edit: Excuse me, I forgot to mention another important part to that discussion. German (or Dutch) umlauts aren't the only use for Unicode. Even if I was typing all my names in pure English, that wouldn't help with physical units. You see, you can stylize volume units as m^3 which is even somewhat wide'ish recognized, a m³ is way simpler and easier to understand. That ³, in case you wonder, isn't part of ASCII so it's either ANSI code pages (please don't get me started on this nightmare) or a Unicode literal. Well, git can deal with Unicode just fine, it doesn't know how to output it on it's CLI returning raw bytes but it can tuck away and retrieve UTF8 code files just fine. Of course I could refer this to some internationalizing framework (which I have and which again runs in Unicode), but m³ is the same all over the world, introducing a layer of indirection there is pointless. It should go without saying of course that the IDE and it's compiler understand UTF8 just fine as

                  Sander RosselS Offline
                  Sander RosselS Offline
                  Sander Rossel
                  wrote on last edited by
                  #19

                  Member 9167057 wrote:

                  such as insistence on building linked lists by hand and freeing them, again by hand

                  That's just madness, unless you're studying linked lists.

                  Member 9167057 wrote:

                  the code stays in Germany

                  "That will never happen" - Some guy before it happened :laugh: It's the biggest lie we keep telling ourselves and a lie that has cost many a company a lot of time, effort and money. You'll get a foreigner in the team, you decide to leave the company, you land in the hospital and someone needs to take over, management decides a team in India is cheaper... All stuff that could happen tomorrow (let's hope that hospital equipment won't crash because someone used non-ASCII characters ;)). I'm thinking about tooling that can't process your project names. They may be tools from the 80's, who knows, but you'll still have to work with them. There's a difference between using proccusl (which is also just madness in this day and age) and using PröceßCüstømerLîst, at least the first can be processed by every human and program everywhere. I think all of us here have stories about applications that crashed because a file wasn't ASCII or UTF-8 or even BOM or whatever. The spaces are pretty annoying as well. I once used spaces in a project name, but quickly switched back once I had to use double quotes in practically every program I used with that application (like Azure DevOps, CLI tools, etc.). The real fun was in using it within another double quoted string, which forced me to use escaped double quoted strings, like cmd = "dotnet build "My project""... Ehhh... :sigh: I can only imagine the pain if that project name includes weird symbols as well, even if YOU can type them. Anyway, if you dislike your team so much because they're stuck in the 70's and 80's then why don't you find another job? I know plenty of places that aren't stuck in the past, but would make very short work of your naming conventions :)

                  Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                  M 1 Reply Last reply
                  0
                  • Sander RosselS Sander Rossel

                    Works fine in both C# and IL.

                    public class Whatever
                    private readonly string someValue;

                    public Whatever(string someValue)
                    {
                        this.someValue = someValue;
                    }
                    

                    }

                    ILDASM gives the following members (or whatever they are): .class public auto ansi beforefieldinit someValue : private initonly string .ctor : void(string) IL of ctor:

                    .method public hidebysig specialname rtspecialname
                    instance void .ctor(string someValue) cil managed
                    {
                    // Code size 16 (0x10)
                    .maxstack 8
                    IL_0000: ldarg.0
                    IL_0001: call instance void [System.Runtime]System.Object::.ctor()
                    IL_0006: nop
                    IL_0007: nop
                    IL_0008: ldarg.0
                    IL_0009: ldarg.1
                    IL_000a: stfld string ConsoleApp1.Whatever::someValue
                    IL_000f: ret
                    } // end of method Whatever::.ctor

                    this.someValue is just different from someValue and by using the full namespace or whatever they can easily be kept apart :) Just like you can have the same class name in multiple namespaces :)

                    Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                    H Offline
                    H Offline
                    honey the codewitch
                    wrote on last edited by
                    #20

                    dude, that's for a local variable. Local variables don't have names in IL! what i said applies to class and struct *members* :) like

                    class Base {
                    int foo;
                    }
                    class Derived :Base {
                    public int foo { get { return base.foo; } } // not allowed i think
                    }

                    When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                    Sander RosselS 1 Reply Last reply
                    0
                    • H honey the codewitch

                      dude, that's for a local variable. Local variables don't have names in IL! what i said applies to class and struct *members* :) like

                      class Base {
                      int foo;
                      }
                      class Derived :Base {
                      public int foo { get { return base.foo; } } // not allowed i think
                      }

                      When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                      Sander RosselS Offline
                      Sander RosselS Offline
                      Sander Rossel
                      wrote on last edited by
                      #21

                      But why would anyone ever do that anyway? :~

                      Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                      H 1 Reply Last reply
                      0
                      • Sander RosselS Sander Rossel

                        Member 9167057 wrote:

                        such as insistence on building linked lists by hand and freeing them, again by hand

                        That's just madness, unless you're studying linked lists.

                        Member 9167057 wrote:

                        the code stays in Germany

                        "That will never happen" - Some guy before it happened :laugh: It's the biggest lie we keep telling ourselves and a lie that has cost many a company a lot of time, effort and money. You'll get a foreigner in the team, you decide to leave the company, you land in the hospital and someone needs to take over, management decides a team in India is cheaper... All stuff that could happen tomorrow (let's hope that hospital equipment won't crash because someone used non-ASCII characters ;)). I'm thinking about tooling that can't process your project names. They may be tools from the 80's, who knows, but you'll still have to work with them. There's a difference between using proccusl (which is also just madness in this day and age) and using PröceßCüstømerLîst, at least the first can be processed by every human and program everywhere. I think all of us here have stories about applications that crashed because a file wasn't ASCII or UTF-8 or even BOM or whatever. The spaces are pretty annoying as well. I once used spaces in a project name, but quickly switched back once I had to use double quotes in practically every program I used with that application (like Azure DevOps, CLI tools, etc.). The real fun was in using it within another double quoted string, which forced me to use escaped double quoted strings, like cmd = "dotnet build "My project""... Ehhh... :sigh: I can only imagine the pain if that project name includes weird symbols as well, even if YOU can type them. Anyway, if you dislike your team so much because they're stuck in the 70's and 80's then why don't you find another job? I know plenty of places that aren't stuck in the past, but would make very short work of your naming conventions :)

                        Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                        M Offline
                        M Offline
                        Member 9167057
                        wrote on last edited by
                        #22

                        Ok, I promise you to replace all umlauts with either their transcriptions (ü->ue) or all names with English when the code goes abroad. Since I'm not high at work, that's something I a) will know and b) will remember when the time comes. That said, I don't see it happening anytime soon. I won't get a foreigner to work on my team because my company doesn't grasp for foreigners because they're cheaper, my company goes for qualifications and, very important in R&D, the will to stay with the company and the product for a while. Unless it's a menial code monkey job, it takes ~2 years to grasp the concepts and become a productive member. You don't outsource to the cheapest for something that takes 2 years to fully get into. I claim that going for the cheapest is the stupidest idea there is anyway. Still, I promise you that I'll English'fy my code should the need arise. With that out of the way, let's get to the other topics. Tooling that works with the project is a base requirement for, well, anything and it hurts me that you assume I see it differently. The thing is, my tools work with my projects just fine. Obviously, the IDE & compiler work. I said earlier that git works with that stuff as well (save for displaying bugs on the CLI I don't care about). What else is there… The file manager obviously works fine, console as well. I hardly do anything interactive in the console anyway, I write scripts to do repeating tasks and the scripts work. Quoting quotes in PowerShell is darn simple, at least as long as only 2 levels of quoting are involved. That, and I wouldn't hard-code "My project", it looks similar to "dotnet build %ProjectNameComingFromADefineOrMacroOrParameter" in my scripts. Hard-coding such stuff is a bad idea, with spaces or without. The moment you rename your project, you may have to adjust the name in several places. As for crashes in your applications, code!=data. Data files, the ones that go out into the world (or return from the world), are a peculiar topic, one very different from what we're talking here. I mean, sure, it's an interesting topic, but I feel that you're including it here to remain right, not because it adds to the discussion at hand. But I have an anecdote myself about how not using Unicode causes odd issues. You may remember physical units from my previous post. Well, a ³ in a West-European code page (or Central European, I don't remember) looks rather differently from some East Asian codepage where my product is also run. That incident was in fact the trigger for me to work in Unic

                        Sander RosselS 1 Reply Last reply
                        0
                        • Sander RosselS Sander Rossel

                          But why would anyone ever do that anyway? :~

                          Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                          H Offline
                          H Offline
                          honey the codewitch
                          wrote on last edited by
                          #23

                          If someone was using a class from a 3rd party library they wouldn't know what private fields are used. So if I name my private field "foo" that means another person's class that uses my library can't use the field "foo" - even a private field in their own derived class. This is why i prefix my private members with underscore - to make it less likely this will happen.

                          When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                          Sander RosselS 1 Reply Last reply
                          0
                          • M Member 9167057

                            Ok, I promise you to replace all umlauts with either their transcriptions (ü->ue) or all names with English when the code goes abroad. Since I'm not high at work, that's something I a) will know and b) will remember when the time comes. That said, I don't see it happening anytime soon. I won't get a foreigner to work on my team because my company doesn't grasp for foreigners because they're cheaper, my company goes for qualifications and, very important in R&D, the will to stay with the company and the product for a while. Unless it's a menial code monkey job, it takes ~2 years to grasp the concepts and become a productive member. You don't outsource to the cheapest for something that takes 2 years to fully get into. I claim that going for the cheapest is the stupidest idea there is anyway. Still, I promise you that I'll English'fy my code should the need arise. With that out of the way, let's get to the other topics. Tooling that works with the project is a base requirement for, well, anything and it hurts me that you assume I see it differently. The thing is, my tools work with my projects just fine. Obviously, the IDE & compiler work. I said earlier that git works with that stuff as well (save for displaying bugs on the CLI I don't care about). What else is there… The file manager obviously works fine, console as well. I hardly do anything interactive in the console anyway, I write scripts to do repeating tasks and the scripts work. Quoting quotes in PowerShell is darn simple, at least as long as only 2 levels of quoting are involved. That, and I wouldn't hard-code "My project", it looks similar to "dotnet build %ProjectNameComingFromADefineOrMacroOrParameter" in my scripts. Hard-coding such stuff is a bad idea, with spaces or without. The moment you rename your project, you may have to adjust the name in several places. As for crashes in your applications, code!=data. Data files, the ones that go out into the world (or return from the world), are a peculiar topic, one very different from what we're talking here. I mean, sure, it's an interesting topic, but I feel that you're including it here to remain right, not because it adds to the discussion at hand. But I have an anecdote myself about how not using Unicode causes odd issues. You may remember physical units from my previous post. Well, a ³ in a West-European code page (or Central European, I don't remember) looks rather differently from some East Asian codepage where my product is also run. That incident was in fact the trigger for me to work in Unic

                            Sander RosselS Offline
                            Sander RosselS Offline
                            Sander Rossel
                            wrote on last edited by
                            #24

                            Member 9167057 wrote:

                            I won't get a foreigner to work on my team because my company doesn't grasp for foreigners because they're cheaper, my company goes for qualifications

                            You're a foreigner yourself to about 99% of the world population. Foreigner != cheap and uncertified ;) And a lot of people still don't know that cheap usually isn't the best option either... Anyway, you make all good points, and when working in your own language, which is very convenient for domain specific terms, I guess it's difficult if your language isn't ASCII. I guess you're right on all accounts, but such pröject names still give me the shivers... :~ I'm pretty sure if I did it one tool or another would break and I'd be in for a world of pain, but I'm doing web dev so it'll break anyway :laugh:

                            Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                            M 1 Reply Last reply
                            0
                            • H honey the codewitch

                              If someone was using a class from a 3rd party library they wouldn't know what private fields are used. So if I name my private field "foo" that means another person's class that uses my library can't use the field "foo" - even a private field in their own derived class. This is why i prefix my private members with underscore - to make it less likely this will happen.

                              When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                              Sander RosselS Offline
                              Sander RosselS Offline
                              Sander Rossel
                              wrote on last edited by
                              #25

                              Interesting. With private fields it's no a problem at all. The base field simply isn't accessible from the derived class. The two fields are simply "BaseClass.someField" and "DerivedClass.someField". Things get different when you make the base class field public.

                              class Program
                              {
                              static void Main(string[] args)
                              {
                              Console.WriteLine(new Derived().SomeValue);
                              Console.WriteLine(new Derived().BaseSomeValue);
                              }
                              }

                              public class Whatever
                              {
                              public string someValue;
                              }

                              public class Derived : Whatever
                              {
                              private string someValue;

                              public Derived()
                              {
                                  base.someValue = "Base someValue.";
                                  someValue = "Witch someValue?"; // using 'this' does nothing.
                              }
                              
                              public string SomeValue => someValue;
                              public string BaseSomeValue => base.someValue;
                              

                              }

                              This prints "Witch someValue?" and "Base someValue.", pretty much as you'd expect. Visual Studio only gives me a warning that someValue hides an inherited base member and that I should use the new keyword if hiding was intended. Basically, both are treated as separate variables, and settings someValue will not set someValue in the base class, neither will setting base.someValue do anything for someValue. Adding the new keyword gets rid of the warning, but doesn't seem to change anything. To get back to your specific example, same thing. new Derived().foo will point to the property, new Base().foo will point to the field (assuming you meant it to be public). And you get a warning that foo hides an inherited member so you should add the new keyword. All in all it's pretty confusing and best avoided :)

                              Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                              1 Reply Last reply
                              0
                              • Sander RosselS Sander Rossel

                                Member 9167057 wrote:

                                I won't get a foreigner to work on my team because my company doesn't grasp for foreigners because they're cheaper, my company goes for qualifications

                                You're a foreigner yourself to about 99% of the world population. Foreigner != cheap and uncertified ;) And a lot of people still don't know that cheap usually isn't the best option either... Anyway, you make all good points, and when working in your own language, which is very convenient for domain specific terms, I guess it's difficult if your language isn't ASCII. I guess you're right on all accounts, but such pröject names still give me the shivers... :~ I'm pretty sure if I did it one tool or another would break and I'd be in for a world of pain, but I'm doing web dev so it'll break anyway :laugh:

                                Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                                M Offline
                                M Offline
                                Member 9167057
                                wrote on last edited by
                                #26

                                I think we can agree then that I'm lucky working at a company where the boss floor isn't occupied by morons. That, and I'm lucky to work with mature tools in a mature ecosystem. That said, my condolences. At least I hope they're well-placed, every time I hear someone doing web dev, I think of http://www.commitstrip.com/en/2015/09/16/how-to-choose-the-right-javascript-framework/

                                Sander RosselS 1 Reply Last reply
                                0
                                • K kmoorevs

                                  I've always preferred the underscore and all lowercase like my_web_app and my_sql_server...kind of a pain with the added shift, but eventually muscle memory kicks in. I know this is against sql server best practices, but I don't follow stupid rules. :laugh:

                                  Sander Rossel wrote:

                                  like a SQL Server, which only allows lower characters.

                                  :confused: This can be enforced?..or is it a policy thing?

                                  "Go forth into the source" - Neal Morse

                                  S Offline
                                  S Offline
                                  sasadler
                                  wrote on last edited by
                                  #27

                                  Yep, that's my preference too. my_web_app just seems easier to read than MyWebApp.

                                  1 Reply Last reply
                                  0
                                  • Sander RosselS Sander Rossel

                                    The everlasting struggle of developers and naming stuff... I'm not quite happy with my current project names (they're a bit longish, Company.Domain.Project.Data, for example), but what's bothering me even more at the moment is my own naming convention in Azure. I prefer PascalCased, like ThisIsMyWebApp, which is fine, except for other resources, like a SQL Server, which only allows lower characters. Long story short, I now have: MyWebApp my-sql-server mystorageaccount I'm now leaning more towards my-sql-server style for everything unless -'s are not possible, like with storage accounts. If this is what I'm worrying about everything must go pretty well, and it does, but this kind of stuff bothers me more than it should :~

                                    Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                                    S Offline
                                    S Offline
                                    steve tabler
                                    wrote on last edited by
                                    #28

                                    Let's see: You can call it foo or bar or fubar You can call me Ray or you can call me Day, or you can call me RayDay. You could put a number on the end. You could use an online theosaurus and find something that measn what you really want to call it. You could get one of those books of baby-names, boys names, girls names, etc, and just use the next name out of that. It works for hurricanes.

                                    1 Reply Last reply
                                    0
                                    • Sander RosselS Sander Rossel

                                      So would it be B****A**M************WebApp or b****-a**-m************-web-app? ;p

                                      Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                                      O Offline
                                      O Offline
                                      Overtkill
                                      wrote on last edited by
                                      #29

                                      I'll take an F. I'd like to buy a vowel Pat, U! I'd like to solve that Puzzle Pat... Sorry, could NOT resist. :) On the topic, I often throw a little slang around when I get bored with naming. An example would be a module I wrote to get domain whois data. I named the function "WhoIsDis" and another "WhoIsDat" for the string data received.

                                      1 Reply Last reply
                                      0
                                      • M Member 9167057

                                        I think we can agree then that I'm lucky working at a company where the boss floor isn't occupied by morons. That, and I'm lucky to work with mature tools in a mature ecosystem. That said, my condolences. At least I hope they're well-placed, every time I hear someone doing web dev, I think of http://www.commitstrip.com/en/2015/09/16/how-to-choose-the-right-javascript-framework/

                                        Sander RosselS Offline
                                        Sander RosselS Offline
                                        Sander Rossel
                                        wrote on last edited by
                                        #30

                                        That's how it is :laugh: Luckily, I don't do all that much front-end work... Which makes those times I do it even harder :sigh:

                                        Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                                        M 1 Reply Last reply
                                        0
                                        • Sander RosselS Sander Rossel

                                          That's how it is :laugh: Luckily, I don't do all that much front-end work... Which makes those times I do it even harder :sigh:

                                          Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                                          M Offline
                                          M Offline
                                          Member 9167057
                                          wrote on last edited by
                                          #31

                                          Now I see your problem with my non-English characters. Correct me if I'm wrong please. As far as I know, having your methods (on the server) called from clients all over the world isn't exactly uncommon making worldwide-compatible naming a hard requirement while in my case, it literally couldn't matter less as my customers get a compiled binary which, save for some places I've used RTTI, doesn't contain any names at all.

                                          Sander RosselS 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups