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. Weak sucks, strong rules

Weak sucks, strong rules

Scheduled Pinned Locked Moved The Lounge
javascriptcsharp
22 Posts 12 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 morzel

    I'm in the middle of some serious refactoring (banking application)... Part of it is JavaScript code and the other part is C#. Whenever I do some changes in C# code I feel like in haven. Maintaining code (especially written by people who no longer work on the project) is soooo much easier within strongly-typed language. I just hope sanity will prevail and one day we will have a chance to write strongly-typed client side code too (directly and without plugins). And yeah, I like jQuery etc. but this recent blind love for JS is just scary...

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

    I agree - the biggest issue I have with Ruby is the duck typing, it's really easy to get oneself in trouble and it results in bad architecture (actually, no architecture). I really miss strong typing and good design practices (mainly interfaces and inheritance) that are simply missing. It doesn't mean that one can't do those things in Ruby, it's just that they're not typically done. I just started looking at WebSharper[^], mainly out of curiosity, and it's interesting that they can convert F# to Javascript. Some interesting possibilities, and it's more in the direction that I'd like to see code being written - write in some common language and use the damn computer to generate the JavaScript. Seems like we're not using our tools to their fullest capacity, but that's nothing new. Marc

    Unit Testing Succinctly

    1 Reply Last reply
    0
    • M morzel

      I'm in the middle of some serious refactoring (banking application)... Part of it is JavaScript code and the other part is C#. Whenever I do some changes in C# code I feel like in haven. Maintaining code (especially written by people who no longer work on the project) is soooo much easier within strongly-typed language. I just hope sanity will prevail and one day we will have a chance to write strongly-typed client side code too (directly and without plugins). And yeah, I like jQuery etc. but this recent blind love for JS is just scary...

      D Offline
      D Offline
      devenv exe
      wrote on last edited by
      #4

      morzel wrote:

      Part of it is JavaScript code and the other part is C#

      at least there is no XML

      "Coming soon"

      1 Reply Last reply
      0
      • A Andrew Torrance

        You may want a gander at typescript ?

        M Offline
        M Offline
        morzel
        wrote on last edited by
        #5

        That's why I wrote "directly and without plugins". TypeScript is nice but like other tools of its kind there's a drawback: you debug other code than you write :(

        V 1 Reply Last reply
        0
        • M morzel

          I'm in the middle of some serious refactoring (banking application)... Part of it is JavaScript code and the other part is C#. Whenever I do some changes in C# code I feel like in haven. Maintaining code (especially written by people who no longer work on the project) is soooo much easier within strongly-typed language. I just hope sanity will prevail and one day we will have a chance to write strongly-typed client side code too (directly and without plugins). And yeah, I like jQuery etc. but this recent blind love for JS is just scary...

          W Offline
          W Offline
          W Balboos GHB
          wrote on last edited by
          #6

          I'm a C++ coder. Aside from a quick note that C# code doesn't distinguish between namespace and class member stuff (always that single dot to divide things, instead of a nice :: ), I feel your pain. Yet, I understand why javaScript (and php) are weakly typed. Ultimately, as a web page, everything ends up as text. It does make sense if you consider that much of what one does ends up, eventually, as HTML - crudely one could argue it has only one type, which is text. So, although the typing in a strongly typed language makes undocumented maintainability more evident - if one ignores overloaded functions - I understand why one would move to the other side and eliminate casts and conversion. PHP, for what it's worth, does have their === operator which is, by-and-large, a way to do some strongly-typed comparisons. There's a place for weakly typed languages - it's a specialization with a place.

          "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

          "As far as we know, our computer has never had an undetected error." - Weisert

          "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

          1 Reply Last reply
          0
          • M morzel

            That's why I wrote "directly and without plugins". TypeScript is nice but like other tools of its kind there's a drawback: you debug other code than you write :(

            V Offline
            V Offline
            vl2
            wrote on last edited by
            #7

            What's the point of strong typing if you still have to debug your code?

            M J 2 Replies Last reply
            0
            • V vl2

              What's the point of strong typing if you still have to debug your code?

              M Offline
              M Offline
              morzel
              wrote on last edited by
              #8

              Is this a serious question?

              V 1 Reply Last reply
              0
              • M morzel

                I'm in the middle of some serious refactoring (banking application)... Part of it is JavaScript code and the other part is C#. Whenever I do some changes in C# code I feel like in haven. Maintaining code (especially written by people who no longer work on the project) is soooo much easier within strongly-typed language. I just hope sanity will prevail and one day we will have a chance to write strongly-typed client side code too (directly and without plugins). And yeah, I like jQuery etc. but this recent blind love for JS is just scary...

                N Offline
                N Offline
                Nicolas Dorier
                wrote on last edited by
                #9

                the point is beginners rarely never follow tutorial whose subject is "refactor this 100 000 LOC project" It's harder to appreciate strong typing from the beginner point of view. For the one that already lost its hair once, the advantages are crystal clear.

                P 1 Reply Last reply
                0
                • M morzel

                  I'm in the middle of some serious refactoring (banking application)... Part of it is JavaScript code and the other part is C#. Whenever I do some changes in C# code I feel like in haven. Maintaining code (especially written by people who no longer work on the project) is soooo much easier within strongly-typed language. I just hope sanity will prevail and one day we will have a chance to write strongly-typed client side code too (directly and without plugins). And yeah, I like jQuery etc. but this recent blind love for JS is just scary...

                  S Offline
                  S Offline
                  Shuqian Ying
                  wrote on last edited by
                  #10

                  2nd law in thermodynamics (physics): it's getting sucker ...

                  Auto generated data services for querying stackExchange's GIS and ServerFault data sets. Email searcher Email Aggregation Manager[^].

                  1 Reply Last reply
                  0
                  • M morzel

                    I'm in the middle of some serious refactoring (banking application)... Part of it is JavaScript code and the other part is C#. Whenever I do some changes in C# code I feel like in haven. Maintaining code (especially written by people who no longer work on the project) is soooo much easier within strongly-typed language. I just hope sanity will prevail and one day we will have a chance to write strongly-typed client side code too (directly and without plugins). And yeah, I like jQuery etc. but this recent blind love for JS is just scary...

                    C Offline
                    C Offline
                    Christopher Duncan
                    wrote on last edited by
                    #11

                    I know this will incur the wrath of many, but client side js has always struck me as the playground for amateurs. Professionals are forced to deal with it and it's possible to write solid, clean js code, but most of what you see on the sites out there is both sloppy and ugly. Error handling seems to be an alien concept and single character variable names are the de facto standard. I can't remember the last time I had a browser up running a debugging session on my own stuff, popped up another tab to go somewhere, and didn't see a boatload of complaints about all manner of stupid and obvious things that no one even bothered to test for. Add to that the fact that once you're on the client side you're basically in IfDef Hell trying to cope with the flakiness and inconsistency of a gazillion browser versions and it's not exactly what I'd call programmer's utopia. I do web development because it pays money. It is, nonetheless, a crappy environment to code in. Client side js stuff just makes it worse.

                    Christopher Duncan Author of Unite the Tribes: Leadership Skills for Technology Managers (2nd ed, just released) Have Fun, Get Paid: How to Make a Living With Your Creativity (Due Nov 2013) The Career Programmer: Guerilla Tactics for an Imperfect World

                    1 Reply Last reply
                    0
                    • N Nicolas Dorier

                      the point is beginners rarely never follow tutorial whose subject is "refactor this 100 000 LOC project" It's harder to appreciate strong typing from the beginner point of view. For the one that already lost its hair once, the advantages are crystal clear.

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #12

                      Nicolas Dorier wrote:

                      harder to appreciate strong typing from the beginner point of view

                      Unrelated, but that reminds me of when I was just learning BASIC -- using floats (x) and heard about integers (x%), and thought, why would would I want to use an integer when the floats work just fine?

                      N 1 Reply Last reply
                      0
                      • V vl2

                        What's the point of strong typing if you still have to debug your code?

                        J Offline
                        J Offline
                        jschell
                        wrote on last edited by
                        #13

                        vl2 wrote:

                        What's the point of strong typing if you still have to debug your code?

                        Presumably you either don't understand what strong typing is or you don't know how to debug any application.

                        V 1 Reply Last reply
                        0
                        • M morzel

                          I'm in the middle of some serious refactoring (banking application)... Part of it is JavaScript code and the other part is C#. Whenever I do some changes in C# code I feel like in haven. Maintaining code (especially written by people who no longer work on the project) is soooo much easier within strongly-typed language. I just hope sanity will prevail and one day we will have a chance to write strongly-typed client side code too (directly and without plugins). And yeah, I like jQuery etc. but this recent blind love for JS is just scary...

                          R Offline
                          R Offline
                          RedDk
                          wrote on last edited by
                          #14

                          Sounds like someone needs a good break from programming. Pick up John Gardner's "Freddy's Book". More evil, but less JavaScript and/or C#.

                          1 Reply Last reply
                          0
                          • P PIEBALDconsult

                            Nicolas Dorier wrote:

                            harder to appreciate strong typing from the beginner point of view

                            Unrelated, but that reminds me of when I was just learning BASIC -- using floats (x) and heard about integers (x%), and thought, why would would I want to use an integer when the floats work just fine?

                            N Offline
                            N Offline
                            Nicolas Dorier
                            wrote on last edited by
                            #15

                            That was a good question :p I guess you understood when it bit you the hard way because, in some odd condition, (a / b) * b != a . Then you started to appreciate the beauty of integers :p

                            P 1 Reply Last reply
                            0
                            • N Nicolas Dorier

                              That was a good question :p I guess you understood when it bit you the hard way because, in some odd condition, (a / b) * b != a . Then you started to appreciate the beauty of integers :p

                              P Offline
                              P Offline
                              PIEBALDconsult
                              wrote on last edited by
                              #16

                              Nicolas Dorier wrote:

                              the beauty of integers

                              And recognized the ugliness of BASIC. :-D That was once I started learning Pascal.

                              1 Reply Last reply
                              0
                              • J jschell

                                vl2 wrote:

                                What's the point of strong typing if you still have to debug your code?

                                Presumably you either don't understand what strong typing is or you don't know how to debug any application.

                                V Offline
                                V Offline
                                vl2
                                wrote on last edited by
                                #17

                                Presumably you never heard of a proper strong, dependent typing. I never had to debug my Coq or Agda code - if it compiles, it works, and it is *proven* to be correct. Why debugging then?

                                1 Reply Last reply
                                0
                                • M morzel

                                  Is this a serious question?

                                  V Offline
                                  V Offline
                                  vl2
                                  wrote on last edited by
                                  #18

                                  Absolutely. What's a point of an incomplete type system which does not carry a correctness proof? If you go into strong typing, do it properly, or don't do it at all.

                                  M 1 Reply Last reply
                                  0
                                  • V vl2

                                    Absolutely. What's a point of an incomplete type system which does not carry a correctness proof? If you go into strong typing, do it properly, or don't do it at all.

                                    M Offline
                                    M Offline
                                    morzel
                                    wrote on last edited by
                                    #19

                                    The fact that code compiles doesn't prove that business requirements are met. Strong typing makes live easier but it doesn't guarantee that program is doing what it should from end user perspective.

                                    V 1 Reply Last reply
                                    0
                                    • M morzel

                                      The fact that code compiles doesn't prove that business requirements are met. Strong typing makes live easier but it doesn't guarantee that program is doing what it should from end user perspective.

                                      V Offline
                                      V Offline
                                      vl2
                                      wrote on last edited by
                                      #20

                                      And how debugging is going to ensure such conformance? QA testing can help, yes, but not debugging. Debugging is useless, as long as your code is guaranteed to do exactly what is specified. If program is working incorrectly from end users' perspective, then specification have to be fixed, not the code.

                                      M 1 Reply Last reply
                                      0
                                      • V vl2

                                        And how debugging is going to ensure such conformance? QA testing can help, yes, but not debugging. Debugging is useless, as long as your code is guaranteed to do exactly what is specified. If program is working incorrectly from end users' perspective, then specification have to be fixed, not the code.

                                        M Offline
                                        M Offline
                                        morzel
                                        wrote on last edited by
                                        #21

                                        I didn't say that debugging is going to ensure conformance to business requirements. All I'm saying is that it is ridiculous to say that strongly typed programs don't need to be debugged. Strongly typed programs contain bugs too. And debugging (stepping through code with a debugger attached) is also a normal part of development. Sometimes its the only way to check what the program is really doing - cause the guys who wrote that +100K LOC (5 years ago) are no longer working at the company end documentation is almost non existing...

                                        V 1 Reply Last reply
                                        0
                                        • M morzel

                                          I didn't say that debugging is going to ensure conformance to business requirements. All I'm saying is that it is ridiculous to say that strongly typed programs don't need to be debugged. Strongly typed programs contain bugs too. And debugging (stepping through code with a debugger attached) is also a normal part of development. Sometimes its the only way to check what the program is really doing - cause the guys who wrote that +100K LOC (5 years ago) are no longer working at the company end documentation is almost non existing...

                                          V Offline
                                          V Offline
                                          vl2
                                          wrote on last edited by
                                          #22

                                          This is not what I said. I said, why bother using "strong" type system if you still have to debug your code afterwards? You either use a real, proper static type system and then you never have to debug your code interactively, or you'll be more flexible with a dynamic type system and do all that hipster interactive stuff. People tend to overuse interactive debugging, and it is really sad. Debugging is not a "normal" part of development. It should be considered a very last resort, when nothing else works. With a proper type system you don't have to step through your code to find out, what the program is "really doing" - types will tell you all about it straight away.

                                          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