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. C#/ / .NET Observation

C#/ / .NET Observation

Scheduled Pinned Locked Moved The Lounge
csharpc++csscomtutorial
38 Posts 22 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.
  • L led mike

    User of Users Group wrote:

    Generics still use the hash

    Yes i reacted to Hashtable and apparently missed the overall point of the thread, oops :doh:

    User of Users Group wrote:

    it has nothing to do with 1.1

    Of course since i missed the point I was talking about this.[^] Generics are the most powerful feature of C# 2.0. Generics allow you to define type-safe data structures, without committing to actual data types. This results in a significant performance boost and higher quality code, because you get to reuse data processing algorithms without duplicating type-specific code. and[^] Collision Resolution in the Dictionary Class

    The Dictionary class differs from the Hashtable class in more ways than one. In addition to being strongly-typed, the Dictionary also employs a different collision resolution strategy than the Hashtable class, using a technique referred to as chaining. Recall that with probing, in the event of a collision another slot in the list of buckets is tried. (With rehashing, the hash is recomputed, and that new slot is tried.) With chaining, however, a secondary data structure is utilized to hold any collisions. Specifically, each slot in the Dictionary has an array of elements that map to that bucket. In the event of a collision, the colliding element is prepended to the bucket's list.

    User of Users Group wrote:

    you are probably not aware

    If and when that is true, I don't know nor will I ever know everything, I am the loose nut breaking things. You might have read my initial post as excluding myself as the nut causing the problems, not so.


    Last modified: 31mins after originally posted --

    E Offline
    E Offline
    El Corazon
    wrote on last edited by
    #24

    led mike wrote:

    because you get to reuse data processing algorithms without duplicating type-specific code.

    Although this is a good thing for some things, again as mentioned it is often used and abused in areas where use of generics do not save the algorithm because the algorithm cannot truly be generic. The case often used for examples of generics is a sort where identification of a number or string or other data item only requires identification of less than or greater than values, such capabilities existed with overloads, though generics allow for one typing, as do templates, etc. But the actual use in the field would probably be an algorithm for line of site for RF which is highly dependant upon frequency and the algorithm actually has to change at various frequencies along the way. Because the guy behind the keyboard thinks generics are a magical automatic process of saving his algorithm for reuse without any real knowledge of what it does, or how it works, or even if it applies to the process in question that he is coding. Such "magical saving graces" are more danger than savings because of that guy behind the keyboard. magic doesn't save anyone, if anything knowledge does, not lack therein. All of these things are more powerful when you put thought behind them, not when they are advertised as basis for less thought. That is where the danger lies.

    _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

    1 Reply Last reply
    0
    • J James R Twine

      As I now need to start getting into C# after a very happy and fruitful live with C++, I have noticed something and wanted to know if any other pre-C#/.NET developers have noticed the same thing.    I have seen LOTS of uses of the Hashtable type - far more than I would expect.  And in places where I would not normally expect.  For example, I have seen keys like "1", "2", "3", etc. (i.e. simple indexers), or seen them used for collections of less than 5 items or so.    It just seems a bit weird to me - I mean, std::map and std::multimap have been around for a number of years, and I have seen plenty of complex systems that rarely used them.  But now I see the simplest systems _(ab)_use Hashtable.    Is it just me, or does anyone else notice that as well?    I am not sure if it is the child with a hammer syndrome or not... What do you think?    Peace!

      -=- James
      Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
      Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
      See DeleteFXPFiles

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #25

      James R. Twine wrote:

      I am not sure if it is the child with a hammer syndrome or not... What do you think?

      My concern is more to do with the standard of developer let loose on the language. We keep seeing posts stating "How do I pass value from form 1 to form 2" and it's obvious that the developers aren't even bothering to think. Just because you can do something quickly in .NET it doesn't mean that you can ignore the basics of design. There's nothing inherently wrong with using a hashtable or a dictionary of some type, but there is something wrong with using it where a simple array would suffice.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      M 1 Reply Last reply
      0
      • P Pete OHanlon

        James R. Twine wrote:

        I am not sure if it is the child with a hammer syndrome or not... What do you think?

        My concern is more to do with the standard of developer let loose on the language. We keep seeing posts stating "How do I pass value from form 1 to form 2" and it's obvious that the developers aren't even bothering to think. Just because you can do something quickly in .NET it doesn't mean that you can ignore the basics of design. There's nothing inherently wrong with using a hashtable or a dictionary of some type, but there is something wrong with using it where a simple array would suffice.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        M Offline
        M Offline
        Mustafa Ismail Mustafa
        wrote on last edited by
        #26

        Sadly yes. This is the root of all evil; trying to tackle a problem without understanding what's needed first. Proper design comes after proper understanding and that comes from using your brain. These days, that's becoming as rare as hen's teeth.

        "Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "The secret to a long and healthy life is simple. Don't get ill and don't die." Pete O'Hanlon, courtesy of Rama Krishna Vavilala

        E 1 Reply Last reply
        0
        • S Stuart Dootson

          Given that I do C++,not C#...when I use STL, I am pretty aware of the big-O characteristics of the different containers - they're specified in the standard, for crying out loud!  C#...dunno - what are the big-O characteristics? I'd presume they are similar to the STL containers...but I really don't know. Also - C#..is it VB6 for the 00's? Not entirely, I'm sure, but I think the VB6 programmers have moved to C# :-)

          M Offline
          M Offline
          Mustafa Ismail Mustafa
          wrote on last edited by
          #27

          Stuart Dootson wrote:

          I think the VB6 programmers have moved to C#

          No, they either learned what OO is and moved to VB.NET or they got promoted into a position where they say, "back in the old days."

          "Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "The secret to a long and healthy life is simple. Don't get ill and don't die." Pete O'Hanlon, courtesy of Rama Krishna Vavilala

          1 Reply Last reply
          0
          • J James R Twine

            As I now need to start getting into C# after a very happy and fruitful live with C++, I have noticed something and wanted to know if any other pre-C#/.NET developers have noticed the same thing.    I have seen LOTS of uses of the Hashtable type - far more than I would expect.  And in places where I would not normally expect.  For example, I have seen keys like "1", "2", "3", etc. (i.e. simple indexers), or seen them used for collections of less than 5 items or so.    It just seems a bit weird to me - I mean, std::map and std::multimap have been around for a number of years, and I have seen plenty of complex systems that rarely used them.  But now I see the simplest systems _(ab)_use Hashtable.    Is it just me, or does anyone else notice that as well?    I am not sure if it is the child with a hammer syndrome or not... What do you think?    Peace!

            -=- James
            Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
            Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
            See DeleteFXPFiles

            R Offline
            R Offline
            Rocky Moore
            wrote on last edited by
            #28

            Now that we have LINQ, I can see the List<> types getting some heavy abuse. Too easy with LINQ to sort, group, calcuate, etc all from a simple List<>. Of course, LINQ works with other objects, but I got a felling some developers will think list about the needs of an app and head straight for simple, quick to implement solutions.

            Rocky <>< Blog Post: Handy utility app that is always on my machines! Tech Blog Post: Moving on up with Windows Live stuff and Plus!

            U 1 Reply Last reply
            0
            • M Mustafa Ismail Mustafa

              Sadly yes. This is the root of all evil; trying to tackle a problem without understanding what's needed first. Proper design comes after proper understanding and that comes from using your brain. These days, that's becoming as rare as hen's teeth.

              "Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "The secret to a long and healthy life is simple. Don't get ill and don't die." Pete O'Hanlon, courtesy of Rama Krishna Vavilala

              E Offline
              E Offline
              El Corazon
              wrote on last edited by
              #29

              Mustafa Ismail Mustafa wrote:

              as rare as hen's teeth.

              actually I think Hen's teeth are far more common.

              _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

              1 Reply Last reply
              0
              • R Rocky Moore

                Now that we have LINQ, I can see the List<> types getting some heavy abuse. Too easy with LINQ to sort, group, calcuate, etc all from a simple List<>. Of course, LINQ works with other objects, but I got a felling some developers will think list about the needs of an app and head straight for simple, quick to implement solutions.

                Rocky <>< Blog Post: Handy utility app that is always on my machines! Tech Blog Post: Moving on up with Windows Live stuff and Plus!

                U Offline
                U Offline
                User of Users Group
                wrote on last edited by
                #30

                I completely agree with everyone on this, but someone has put it very simply back in the day (forget who it was). "Professional programming isn't for the masses, MS is going against that. Same goes for similar Wrox titles." I disagree just a tad, because obviously .NET has pushed out the envelope and produced some good stuff, but it is producing big-heads far faster. In my mind, to consider oneself as a master of abstraction is very hard for me, and I wonder who would when they look at the number of times they refactor their code (if they can afford it), or say when they look Boost and go WTF (that is the leadership there, if you care about types. Sure it has its quirks in few areas , but if anything it demonstrates what kind of true abstract heads we are up against; Hibernate and Castle people, please stay clear as it is beyond ORM-loving childplay)

                P 1 Reply Last reply
                0
                • U User of Users Group

                  I completely agree with everyone on this, but someone has put it very simply back in the day (forget who it was). "Professional programming isn't for the masses, MS is going against that. Same goes for similar Wrox titles." I disagree just a tad, because obviously .NET has pushed out the envelope and produced some good stuff, but it is producing big-heads far faster. In my mind, to consider oneself as a master of abstraction is very hard for me, and I wonder who would when they look at the number of times they refactor their code (if they can afford it), or say when they look Boost and go WTF (that is the leadership there, if you care about types. Sure it has its quirks in few areas , but if anything it demonstrates what kind of true abstract heads we are up against; Hibernate and Castle people, please stay clear as it is beyond ORM-loving childplay)

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #31

                  User of Users Group wrote:

                  "Professional programming isn't for the masses, MS is going against that. Same goes for similar Wrox titles." I disagree just a tad, because obviously .NET has pushed out the envelope and produced some good stuff, but it is producing big-heads far faster.

                  I'm not sure it's quite that - what I think is true is that there is more of a take up by people who are inherently unsuited to developing. Good developers have a breadth of knowledge and an interest in expanding their knowledge in many different areas, by learning other languages or by trying different architectures/techniques. Then there are the others - the people who I would term The Google Cut and Paste Monkeys. They want answers spoon fed to them, and they look for the next quick coding hit/new technology without bothering to look into them at all. I blame MS for their statement in the early 90s that they wanted to create systems that would remove the need for developers.

                  Deja View - the feeling that you've seen this post before.

                  My blog | My articles

                  U 1 Reply Last reply
                  0
                  • P Pete OHanlon

                    User of Users Group wrote:

                    "Professional programming isn't for the masses, MS is going against that. Same goes for similar Wrox titles." I disagree just a tad, because obviously .NET has pushed out the envelope and produced some good stuff, but it is producing big-heads far faster.

                    I'm not sure it's quite that - what I think is true is that there is more of a take up by people who are inherently unsuited to developing. Good developers have a breadth of knowledge and an interest in expanding their knowledge in many different areas, by learning other languages or by trying different architectures/techniques. Then there are the others - the people who I would term The Google Cut and Paste Monkeys. They want answers spoon fed to them, and they look for the next quick coding hit/new technology without bothering to look into them at all. I blame MS for their statement in the early 90s that they wanted to create systems that would remove the need for developers.

                    Deja View - the feeling that you've seen this post before.

                    My blog | My articles

                    U Offline
                    U Offline
                    User of Users Group
                    wrote on last edited by
                    #32

                    > that would remove the need for developers. Rings some bells, and btw this is what I believe DB is talking about in his recent blog entry on 'overfactoring forewords', you know generics and that. After all, WCF is one of the pieces you see that is clearly showing less development effort and more configuration expertise( hey hate the word but that is what it is: IT!). WPF aims to take it into media and design space too. But I am supripsed at how repetative/similar it is to past tech, and especially as WS falters. So while it does look like a step forward in terms of factoring, at least in that ahm *research* attempt (bold to say but I don't think WinFX will really rock the world), apart from some awful looking code when dealing with communication endpoints. Hey if it produces a good idea where you pay slightly less in XML and runtime penalties down the road I am all up for it, but that is what is lacking out there.. implementation of environments that do not introduce any runtime penalty whatsoever. And that, ties into the topic, which is compiler work I believe (to 'ease'/force-to-think and warn very early; best of both worlds etc).. Pretty tough subject for me at the very least.

                    1 Reply Last reply
                    0
                    • M Marc Clifton

                      protected KeyedList<ViewListenerKey, List<SessionContainerListener>> viewListeners;
                      protected KeyedList<ViewListenerKey, ViewKeyData> viewKeyData;
                      protected KeyedList<SessionContainerViewListenerKey, List<DataTable>> sessionTransactions;

                      Run. Don't walk, run. :-D Marc

                      Thyme In The Country Interacx My Blog

                      D Offline
                      D Offline
                      Daniel Grunwald
                      wrote on last edited by
                      #33

                      If often using nested generics. Though recently I found this: IEnumerable<KeyValuePair<LineSegment, List<TextWord>>> I think 3 levels might be a bit too much...

                      M 1 Reply Last reply
                      0
                      • realJSOPR realJSOP

                        I have never knowingly used a hashtable in C#, and I stayed as far away as possible from STL when I was doing C++.

                        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                        -----
                        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                        A Offline
                        A Offline
                        Anders Molin
                        wrote on last edited by
                        #34

                        John Simmons / outlaw programmer wrote:

                        and I stayed as far away as possible from STL when I was doing C++.

                        Same here, I never got used to STL...

                        - Anders

                        1 Reply Last reply
                        0
                        • D Daniel Grunwald

                          If often using nested generics. Though recently I found this: IEnumerable<KeyValuePair<LineSegment, List<TextWord>>> I think 3 levels might be a bit too much...

                          M Offline
                          M Offline
                          Marc Clifton
                          wrote on last edited by
                          #35

                          Daniel Grunwald wrote:

                          I think 3 levels might be a bit too much...

                          Yeah, I'm not even happy with the code snippet I posted. When I was working in C++, I made it a steadfast rule to always wrap a nested collection in a class, becaue you never knew when something would go from "simple type" to "complex type" in the requirements. So, in your above code snippet, I would probably do something like may List into a TextWordList class, and the repeat the process until the collection made sense. Marc

                          Thyme In The Country Interacx My Blog

                          1 Reply Last reply
                          0
                          • M Marc Clifton

                            Nemanja Trifunovic wrote:

                            but creating the complete UI out of some crazy XML files with reflection was simply wrong - it made the application less robust and it would take forever to start.

                            :~ :-D Marc

                            Thyme In The Country Interacx My Blog

                            J Offline
                            J Offline
                            J Dunlap
                            wrote on last edited by
                            #36

                            :laugh: Get going on that MyXaml compiler! ;-P Oh wait - I was the one that first said I was going to do one... :-O

                            1 Reply Last reply
                            0
                            • J James R Twine

                              As I now need to start getting into C# after a very happy and fruitful live with C++, I have noticed something and wanted to know if any other pre-C#/.NET developers have noticed the same thing.    I have seen LOTS of uses of the Hashtable type - far more than I would expect.  And in places where I would not normally expect.  For example, I have seen keys like "1", "2", "3", etc. (i.e. simple indexers), or seen them used for collections of less than 5 items or so.    It just seems a bit weird to me - I mean, std::map and std::multimap have been around for a number of years, and I have seen plenty of complex systems that rarely used them.  But now I see the simplest systems _(ab)_use Hashtable.    Is it just me, or does anyone else notice that as well?    I am not sure if it is the child with a hammer syndrome or not... What do you think?    Peace!

                              -=- James
                              Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
                              Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
                              See DeleteFXPFiles

                              P Online
                              P Online
                              PIEBALDconsult
                              wrote on last edited by
                              #37

                              James R. Twine wrote:

                              I am not sure if it is the child with a hammer syndrome or not

                              Nah, teenager with his first girlfriend syndrome. Wants to spend a lot of time with it, shower it with attention, discover its properties, put things in it. I never did much with C++, just dabbled; I did mostly C. Switching to C# and .net was like the first day of high school in Malibu (I'm guessing). "I know little of these 60s sitcoms of which you speak." -- Slartibartfast

                              1 Reply Last reply
                              0
                              • E Ennis Ray Lynch Jr

                                A lot of developers learn by copy-and-paste and have not been exposed to the other collection options in .NET. Personally, my predominate collection type is the generic List<>. In the .NET environment the efficiency is close so many choose the hash incorrectly thinking it does not matter. I have many discussions with Junior developers about the importance of order in certain sets. Most of which falls on deaf ears until something blows up in there face.

                                Need a C# Consultant? I'm available.
                                Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

                                B Offline
                                B Offline
                                Brady Kelly
                                wrote on last edited by
                                #38

                                List rocks! I'm just sorry it doesn't expose it's methods as virtual. I have so many situations where I need to attach descriptive data to a list, and using composition is a PITA. I have to guess which List methods to redirect up front, such as Add, and Remove, and an iterator. Then, later on in code, I find I need more IList features, such as Contains etc. I also don't like exposing the contained List, as it's cumbersome to always first reference the List property.

                                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