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. Into bad habits

Into bad habits

Scheduled Pinned Locked Moved The Lounge
csharpjavascriptcomhelp
40 Posts 18 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.
  • R Rob Grainger

    Most essential comment on the thread. Could only be improved by a link: JSLint[^]

    J Offline
    J Offline
    Jeremy Hutchinson
    wrote on last edited by
    #27

    I really like the use of the word "Tolerate" in the settings on that page. It's like they are saying "[setting] is a bad idea, but if you want we have to we can tolerate it." It's just such a better word than "Allow" for crap like that.

    F 1 Reply Last reply
    0
    • F Fran Porretto

      Your point is why I favor the teaching of strict prescriptive grammar in primary schools...yet I find that I prefer unmanaged C++ to managed (and more restrictive) C#.

      There's no doubt that strict prescription results in fewer errors of the type you described. But all things have their price, and the price of strict prescription in software is that now and then you'll need to work around the language's constraints to accomplish what you need to accomplish. It's a tradeoff, and like most such, there's no way to answer the question "Should I use this language?" without measuring its characteristics against the demands of the application you need to write.

      A good engineer, like a good mechanic, always selects the right tool for the job he faces. Some languages are better for speed; others for safety; others for the support they provide for specific application needs. Few of us can afford to restrict ourselves to just one of them.

      F Offline
      F Offline
      Fabio Franco
      wrote on last edited by
      #28

      Fran Porretto wrote:

      yet I find that I prefer unmanaged C++ to managed (and more restrictive) C#.

      I actually agree with you that C++ is better for teaching newcomers because it allows the students to have a grasp on memory allocation and management. They get to understand a little more about the heap and the stack while newcomers that go directly to a managed language will have no idea on how those work.

      Fran Porretto wrote:

      A good engineer, like a good mechanic, always selects the right tool for the job he faces

      Agree, but isn't really the point I was trying to make. The point I was trying to make is whether or not one should favor strict languages to develop good habits and avoid bad ones.

      "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

      1 Reply Last reply
      0
      • J Jeremy Hutchinson

        I really like the use of the word "Tolerate" in the settings on that page. It's like they are saying "[setting] is a bad idea, but if you want we have to we can tolerate it." It's just such a better word than "Allow" for crap like that.

        F Offline
        F Offline
        Fabio Franco
        wrote on last edited by
        #29

        :laugh: At least there's something for those that are willing.

        "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

        1 Reply Last reply
        0
        • B BobJanova

          If myInt doesn't have the 1 bit set, i.e. if it's even.

          F Offline
          F Offline
          Fabio Franco
          wrote on last edited by
          #30

          true :)

          "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

          1 Reply Last reply
          0
          • F Fabio Franco

            So, today I saw this on CP's daily news: How One Missing `var` Ruined our Launch[^] There's always been endless discussions that it's not about the language, but about the programmer when bad practices arise. Like endless flaming wars against languages VB and JS. Now, to add some more fuel to the debate I'd like to ask: Why some mistake like that happened? It was a simple mistake with serious consequences. The first thing that came to my mind was that, I'd never make such a mistake (ok, maybe 0.00000001% of chance to make it). To me it's like driving without seat-belts. There's no way I'd do it because Brazilian traffic laws are so strict about it that I got very used to it, the same way I'm used to wear clothes when I leave home. Now, by programming on strict languages for the most part of my professional life, declaring variables became the same way, it's just natural, it would feels wrong and just the thought of it bothers me. Would it be the same if I got used developing on more forgiving languages like JS? Do forgiving languages make us more sloppy? I think the forgiving languages may shape us to acquire bad habits. That's one of the reasons I favor C# to VB.Net. There were countless times that I heard: "Bad code can be written in any language". But that's not the point. I'm sure that if I had done more work in more forgiving languages I'd be much more likely to commit mistakes like that. That's why I favor strict languages more. They help you develop good habits that are independent of the fact of a good or bad programmer. Thoughts?

            "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

            B Offline
            B Offline
            BrainiacV
            wrote on last edited by
            #31

            You ain't seen nothing until you go cruising through some of the HTML I now maintain. I never realized how sloppy you could get with it. Missing end tags is one thing, but some screens don't even bother to begin with . If I had known years ago when I first started doing web applications that I could have three or four statements in the same document, I wouldn't have had near the coding hoops to jump through when Corporate forced some headers and footers on us that consultants had put together without bothering to consult with the programmers. I certainly believe the languages should force some constraints on you. Not to the degree of Pascal's straitjacket worn willingly, but variable declarations and loops that give you definite structure. I absolutely hate C's (and all its variants) FOR statement. At least in BASIC you know what is the control variable and its limits. I once coded a C FOR statement such that the variables being set, tested, and incremented, had nothing to do with the loop. I was totally disgusted that the language let me get away with it because I'd worked with enough idiots who would do something like that in their code thinking they were clever. I've spent most of my career cleaning up the crap code left by others, that I don't need to work in languages that allow you to do stupid stuff either by design or omission. Self discipline is generally not enough to write good code.

            Psychosis at 10 Film at 11 Those who do not remember the past, are doomed to repeat it. Those who do not remember the past, cannot build upon it.

            1 Reply Last reply
            0
            • F Fabio Franco

              So, today I saw this on CP's daily news: How One Missing `var` Ruined our Launch[^] There's always been endless discussions that it's not about the language, but about the programmer when bad practices arise. Like endless flaming wars against languages VB and JS. Now, to add some more fuel to the debate I'd like to ask: Why some mistake like that happened? It was a simple mistake with serious consequences. The first thing that came to my mind was that, I'd never make such a mistake (ok, maybe 0.00000001% of chance to make it). To me it's like driving without seat-belts. There's no way I'd do it because Brazilian traffic laws are so strict about it that I got very used to it, the same way I'm used to wear clothes when I leave home. Now, by programming on strict languages for the most part of my professional life, declaring variables became the same way, it's just natural, it would feels wrong and just the thought of it bothers me. Would it be the same if I got used developing on more forgiving languages like JS? Do forgiving languages make us more sloppy? I think the forgiving languages may shape us to acquire bad habits. That's one of the reasons I favor C# to VB.Net. There were countless times that I heard: "Bad code can be written in any language". But that's not the point. I'm sure that if I had done more work in more forgiving languages I'd be much more likely to commit mistakes like that. That's why I favor strict languages more. They help you develop good habits that are independent of the fact of a good or bad programmer. Thoughts?

              "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

              A Offline
              A Offline
              agolddog
              wrote on last edited by
              #32

              I think it's a little bit of the chicken-and-the-egg problem. Forgiving languages are (IMO) geared toward a specific audience: people who want to develop software, but perhaps aren't as tehcnically minded, as interested and/or, to be frank, as thorough as other developers. Thus, the people who use those languages tend to be sloppier developers, and make more mistakes. This is not to say that there aren't very good developers using the more 'forgiving' languages, and very poor ones using the 'less'. However, for anyone to suggest that, as a class, VB developers are better than C# developers, well, I don't think that stands up under scrutiny. There are certainly overlaps in those two populations though.

              1 Reply Last reply
              0
              • F Fabio Franco

                So, today I saw this on CP's daily news: How One Missing `var` Ruined our Launch[^] There's always been endless discussions that it's not about the language, but about the programmer when bad practices arise. Like endless flaming wars against languages VB and JS. Now, to add some more fuel to the debate I'd like to ask: Why some mistake like that happened? It was a simple mistake with serious consequences. The first thing that came to my mind was that, I'd never make such a mistake (ok, maybe 0.00000001% of chance to make it). To me it's like driving without seat-belts. There's no way I'd do it because Brazilian traffic laws are so strict about it that I got very used to it, the same way I'm used to wear clothes when I leave home. Now, by programming on strict languages for the most part of my professional life, declaring variables became the same way, it's just natural, it would feels wrong and just the thought of it bothers me. Would it be the same if I got used developing on more forgiving languages like JS? Do forgiving languages make us more sloppy? I think the forgiving languages may shape us to acquire bad habits. That's one of the reasons I favor C# to VB.Net. There were countless times that I heard: "Bad code can be written in any language". But that's not the point. I'm sure that if I had done more work in more forgiving languages I'd be much more likely to commit mistakes like that. That's why I favor strict languages more. They help you develop good habits that are independent of the fact of a good or bad programmer. Thoughts?

                "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                S Offline
                S Offline
                Sasha Laurel
                wrote on last edited by
                #33

                You're point about VB is only valid with "Option Strict Off". You need to use "Option Strict On". You'll find its a lot less forgiving than you put on. You may even find that it is less forgiving than C# in some ways (it forces you to be more explicit about what your intentions are, no "var" keyword, etc). I recommend that all VB developers use Option Strict. It will save you loads of headaches when you actually take advantage of static type checking.

                F 1 Reply Last reply
                0
                • F Fabio Franco

                  So, today I saw this on CP's daily news: How One Missing `var` Ruined our Launch[^] There's always been endless discussions that it's not about the language, but about the programmer when bad practices arise. Like endless flaming wars against languages VB and JS. Now, to add some more fuel to the debate I'd like to ask: Why some mistake like that happened? It was a simple mistake with serious consequences. The first thing that came to my mind was that, I'd never make such a mistake (ok, maybe 0.00000001% of chance to make it). To me it's like driving without seat-belts. There's no way I'd do it because Brazilian traffic laws are so strict about it that I got very used to it, the same way I'm used to wear clothes when I leave home. Now, by programming on strict languages for the most part of my professional life, declaring variables became the same way, it's just natural, it would feels wrong and just the thought of it bothers me. Would it be the same if I got used developing on more forgiving languages like JS? Do forgiving languages make us more sloppy? I think the forgiving languages may shape us to acquire bad habits. That's one of the reasons I favor C# to VB.Net. There were countless times that I heard: "Bad code can be written in any language". But that's not the point. I'm sure that if I had done more work in more forgiving languages I'd be much more likely to commit mistakes like that. That's why I favor strict languages more. They help you develop good habits that are independent of the fact of a good or bad programmer. Thoughts?

                  "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                  S Offline
                  S Offline
                  sgorozco
                  wrote on last edited by
                  #34

                  Hello Fabio, I agree with you 100%, I think strictness in the language is something very desirable, especially considering that many of us coders tend to have some very intense periods, where maybe you get to sleep a couple of hours a day if you're lucky. I know there are gifted people that thrive in such intense pressure periods, but at least in my case, with sleep depravation, I tend to see a dramatic rise in my mistakes, and I certainly like to know the compiler is helping me a bit with the error count. :P Regarding the Meloncard article, I think the developer is cutting himself some slack. The mistake may appear to be subtle indeed, but I strongly believe it's a mistake that would have shown up in a simple two-concurrent user test. Maybe I'm wrong, but it's not the first time where I see a contrived technical-jargon full excuse that attempts to divert direct responsibility over an issue. Cheers! =)

                  F 1 Reply Last reply
                  0
                  • S Sasha Laurel

                    You're point about VB is only valid with "Option Strict Off". You need to use "Option Strict On". You'll find its a lot less forgiving than you put on. You may even find that it is less forgiving than C# in some ways (it forces you to be more explicit about what your intentions are, no "var" keyword, etc). I recommend that all VB developers use Option Strict. It will save you loads of headaches when you actually take advantage of static type checking.

                    F Offline
                    F Offline
                    Fabio Franco
                    wrote on last edited by
                    #35

                    Vaughn Bigham wrote:

                    You're point about VB is only valid with "Option Strict Off".

                    It defintelly helps, but it's not all. Even with that option on, VB still performs a lot of implicit conversions on uncompatible types. Suddenly you can apply the equals operator in lots of places you shouldn't. And I think that's pretty dangerous.

                    "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                    1 Reply Last reply
                    0
                    • S sgorozco

                      Hello Fabio, I agree with you 100%, I think strictness in the language is something very desirable, especially considering that many of us coders tend to have some very intense periods, where maybe you get to sleep a couple of hours a day if you're lucky. I know there are gifted people that thrive in such intense pressure periods, but at least in my case, with sleep depravation, I tend to see a dramatic rise in my mistakes, and I certainly like to know the compiler is helping me a bit with the error count. :P Regarding the Meloncard article, I think the developer is cutting himself some slack. The mistake may appear to be subtle indeed, but I strongly believe it's a mistake that would have shown up in a simple two-concurrent user test. Maybe I'm wrong, but it's not the first time where I see a contrived technical-jargon full excuse that attempts to divert direct responsibility over an issue. Cheers! =)

                      F Offline
                      F Offline
                      Fabio Franco
                      wrote on last edited by
                      #36

                      sgorozco wrote:

                      Maybe I'm wrong, but it's not the first time where I see a contrived technical-jargon full excuse that attempts to divert direct responsibility over an issue.

                      :laugh:

                      "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                      1 Reply Last reply
                      0
                      • F Fabio Franco

                        So, today I saw this on CP's daily news: How One Missing `var` Ruined our Launch[^] There's always been endless discussions that it's not about the language, but about the programmer when bad practices arise. Like endless flaming wars against languages VB and JS. Now, to add some more fuel to the debate I'd like to ask: Why some mistake like that happened? It was a simple mistake with serious consequences. The first thing that came to my mind was that, I'd never make such a mistake (ok, maybe 0.00000001% of chance to make it). To me it's like driving without seat-belts. There's no way I'd do it because Brazilian traffic laws are so strict about it that I got very used to it, the same way I'm used to wear clothes when I leave home. Now, by programming on strict languages for the most part of my professional life, declaring variables became the same way, it's just natural, it would feels wrong and just the thought of it bothers me. Would it be the same if I got used developing on more forgiving languages like JS? Do forgiving languages make us more sloppy? I think the forgiving languages may shape us to acquire bad habits. That's one of the reasons I favor C# to VB.Net. There were countless times that I heard: "Bad code can be written in any language". But that's not the point. I'm sure that if I had done more work in more forgiving languages I'd be much more likely to commit mistakes like that. That's why I favor strict languages more. They help you develop good habits that are independent of the fact of a good or bad programmer. Thoughts?

                        "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                        F Offline
                        F Offline
                        Fabio Franco
                        wrote on last edited by
                        #37

                        For those 1 voters, at least have the decency to put some argument about it.

                        "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                        1 Reply Last reply
                        0
                        • F Fabio Franco

                          So, today I saw this on CP's daily news: How One Missing `var` Ruined our Launch[^] There's always been endless discussions that it's not about the language, but about the programmer when bad practices arise. Like endless flaming wars against languages VB and JS. Now, to add some more fuel to the debate I'd like to ask: Why some mistake like that happened? It was a simple mistake with serious consequences. The first thing that came to my mind was that, I'd never make such a mistake (ok, maybe 0.00000001% of chance to make it). To me it's like driving without seat-belts. There's no way I'd do it because Brazilian traffic laws are so strict about it that I got very used to it, the same way I'm used to wear clothes when I leave home. Now, by programming on strict languages for the most part of my professional life, declaring variables became the same way, it's just natural, it would feels wrong and just the thought of it bothers me. Would it be the same if I got used developing on more forgiving languages like JS? Do forgiving languages make us more sloppy? I think the forgiving languages may shape us to acquire bad habits. That's one of the reasons I favor C# to VB.Net. There were countless times that I heard: "Bad code can be written in any language". But that's not the point. I'm sure that if I had done more work in more forgiving languages I'd be much more likely to commit mistakes like that. That's why I favor strict languages more. They help you develop good habits that are independent of the fact of a good or bad programmer. Thoughts?

                          "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                          D Offline
                          D Offline
                          Duarte Cunha Leao
                          wrote on last edited by
                          #38

                          Having programmed several years with JS, and as many years with statically typed languages, my experience is quite the opposite. The lack of compiler on dynamic languages forces you to have a bigger discipline, in what concerns naming variables (of course creating them is included), for example, than with compiled languages, in which the compiler guides you into doing something valid. The lack of type information in variables, arguments, return values, etc, also places a greater pressure on careful naming. Today, I'm sure I'm a better programmer because I wrote so much non-compiled code - it forced me to always be sure of what I was doing (opposed to stepping through to find out...), and strengthened my discipline. A compiler is surely a great tool, but it doesn't replace the understanding and discipline of the programmer. It's quite the same as with writing with a spelling checker, you never get to learn certain things because you count too much on the checker, or, as with a making calculations by hand or with the help of a calculator... This could be heaven for everyone

                          F 1 Reply Last reply
                          0
                          • D Duarte Cunha Leao

                            Having programmed several years with JS, and as many years with statically typed languages, my experience is quite the opposite. The lack of compiler on dynamic languages forces you to have a bigger discipline, in what concerns naming variables (of course creating them is included), for example, than with compiled languages, in which the compiler guides you into doing something valid. The lack of type information in variables, arguments, return values, etc, also places a greater pressure on careful naming. Today, I'm sure I'm a better programmer because I wrote so much non-compiled code - it forced me to always be sure of what I was doing (opposed to stepping through to find out...), and strengthened my discipline. A compiler is surely a great tool, but it doesn't replace the understanding and discipline of the programmer. It's quite the same as with writing with a spelling checker, you never get to learn certain things because you count too much on the checker, or, as with a making calculations by hand or with the help of a calculator... This could be heaven for everyone

                            F Offline
                            F Offline
                            Fabio Franco
                            wrote on last edited by
                            #39

                            I agree that somethings you don't learn because the compiler and IDE helps you. But if one doesb't have discipline like yourself, I think it doesn't make a better programmer. But who knows, I'd still wear seat-belts on countries that do not enforce to. It's automatic... Some still do even when not enforced but I bet the rate is much lower on country that it is. :)

                            "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                            1 Reply Last reply
                            0
                            • H hairy_hats

                              I look forward to the day when compilers give a warning because you've indented the braces... ;)

                              N Offline
                              N Offline
                              Nchek2000
                              wrote on last edited by
                              #40

                              go python!

                              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