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. Other Discussions
  3. The Weird and The Wonderful
  4. Overpaid, over engineered and totally in-yer-face...

Overpaid, over engineered and totally in-yer-face...

Scheduled Pinned Locked Moved The Weird and The Wonderful
16 Posts 6 Posters 1 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 Lost User

    It's been a while since I've seen any VB..

    Public ReadOnly Property Enabled As Boolean
    Get
    Return m_enabled
    End Get
    End Property

    C# certainly appears to be slightly cleaner in my opinion, although it's a matter of preference/working environment/etc..

    public readonly bool Enabled { get { return m_enabled; } }

    How do you know so much about swallows? Well, you have to know these things when you're a king, you know.

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

    Public Property Something As String
    Get
    Return _Something
    End Get
    Set(value As String)
    _Something = value
    End Set
    End Property

    public string Something
    {
    get
    {
    return _Something;
    }
    set
    {
    _Something = value;
    }
    }

    That's eight vs. eleven lines. It adds up! I always find VB has a vertical cleanliness whereas C# has a horizontal cleanliness :) I love both languages by the way. It's just a little bit easier to write messy code in VB due to backwards compatibility with VB1-6, but you can write utter crap in both languages any language! Started out in VB.NET and later moved to C#.

    Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

    Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

    Regards, Sander

    L 1 Reply Last reply
    0
    • Sander RosselS Sander Rossel

      Public Property Something As String
      Get
      Return _Something
      End Get
      Set(value As String)
      _Something = value
      End Set
      End Property

      public string Something
      {
      get
      {
      return _Something;
      }
      set
      {
      _Something = value;
      }
      }

      That's eight vs. eleven lines. It adds up! I always find VB has a vertical cleanliness whereas C# has a horizontal cleanliness :) I love both languages by the way. It's just a little bit easier to write messy code in VB due to backwards compatibility with VB1-6, but you can write utter crap in both languages any language! Started out in VB.NET and later moved to C#.

      Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

      Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

      Regards, Sander

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #8

      In your example, VB has 20 keywords, variable names, etc. C# has 9. Nuff said :)

      How do you know so much about swallows? Well, you have to know these things when you're a king, you know.

      Sander RosselS 1 Reply Last reply
      0
      • L Lost User

        In your example, VB has 20 keywords, variable names, etc. C# has 9. Nuff said :)

        How do you know so much about swallows? Well, you have to know these things when you're a king, you know.

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

        But still less vertical space! :laugh:

        Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

        Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

        Regards, Sander

        L 1 Reply Last reply
        0
        • Sander RosselS Sander Rossel

          But still less vertical space! :laugh:

          Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

          Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

          Regards, Sander

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #10

          Sander Rossel wrote:

          But still less vertical space! :laugh:

          public string Something
          {
          get { return _Something; }
          set { _Something = value; }
          }

          Where, exactly?

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          Sander RosselS L S 3 Replies Last reply
          0
          • L Lost User

            Sander Rossel wrote:

            But still less vertical space! :laugh:

            public string Something
            {
            get { return _Something; }
            set { _Something = value; }
            }

            Where, exactly?

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

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

            Stop ruining my point with your better syntax![^] :laugh: So maybe properties aren't the best example... Let's look at a switch statement? Always loved them in VB, but disliked them in C# (mandatory break!?)... :)

            Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

            Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

            Regards, Sander

            1 Reply Last reply
            0
            • L Lost User

              Sander Rossel wrote:

              But still less vertical space! :laugh:

              public string Something
              {
              get { return _Something; }
              set { _Something = value; }
              }

              Where, exactly?

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #12

              Yep, that's how I would write simple getters and setters. I only go multiline if there's some additional logic in there :)

              How do you know so much about swallows? Well, you have to know these things when you're a king, you know.

              1 Reply Last reply
              0
              • L Lost User

                Sander Rossel wrote:

                But still less vertical space! :laugh:

                public string Something
                {
                get { return _Something; }
                set { _Something = value; }
                }

                Where, exactly?

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                S Offline
                S Offline
                Sinisa Hajnal
                wrote on last edited by
                #13

                In VB.NET you could type only Public String Something variable _Someting would be internally created and accessible without explicit definition. I don't know if they added it in C# too.. While there are more keywords, intellisense is better and there is actually less typing in vb version :)

                L 1 Reply Last reply
                0
                • S Sinisa Hajnal

                  In VB.NET you could type only Public String Something variable _Someting would be internally created and accessible without explicit definition. I don't know if they added it in C# too.. While there are more keywords, intellisense is better and there is actually less typing in vb version :)

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #14

                  Similar like C#, but there the generated backing-field is not accessible. http://www.infoq.com/news/2009/06/Auto-Properties[^]

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                  1 Reply Last reply
                  0
                  • D Duncan Edwards Jones

                    One of my own little beauties to show why I should be kept on a short leash...

                    ''' <summary>
                    ''' Projection over the client event stream to summarise the state of a client
                    ''' </summary>
                    Public NotInheritable Class ClientSummaryProjection
                    Inherits ProjectionBase(Of AggregateIdentifiers.ClientAggregateIdentity)
                    Implements IEventConsumer(Of AggregateIdentifiers.ClientAggregateIdentity, Events.Client.NewBazaarCreatedEvent)
                    Implements IEventConsumer(Of AggregateIdentifiers.ClientAggregateIdentity, Events.Client.BazaarClosedEvent)
                    Implements IEventConsumer(Of AggregateIdentifiers.ClientAggregateIdentity, Events.Client.CreatedEvent)
                    Implements IEventConsumer(Of AggregateIdentifiers.ClientAggregateIdentity, Events.Client.ClientNameChangedEvent)
                    Implements IEventConsumer(Of AggregateIdentifiers.ClientAggregateIdentity, Events.Client.DisabledEvent)
                    Implements IEventConsumer(Of AggregateIdentifiers.ClientAggregateIdentity, Events.Client.EnabledEvent)

                    ReadOnly m\_identity As AggregateIdentifiers.ClientAggregateIdentity
                    ''' <summary>
                    ''' The aggregate identifier of the client over which this projection applies
                    ''' </summary>
                    Public Overrides ReadOnly Property Identity As AggregateIdentifiers.ClientAggregateIdentity
                        Get
                            Return m\_identity
                        End Get
                    End Property
                    
                    
                    Private m\_openBazaars As Integer
                    ''' <summary>
                    ''' The number of Bazaars open at this point in time
                    ''' </summary>
                    Public ReadOnly Property OpenBazaars As Integer
                        Get
                            Return m\_openBazaars
                        End Get
                    End Property
                    
                    Private m\_totalBazaars As Integer
                    ''' <summary>
                    ''' The total number of bazaars ever opened for this client at this point in time
                    ''' </summary>
                    Public ReadOnly Property TotalBazaars As Integer
                        Get
                            Return m\_totalBazaars
                        End Get
                    End Property
                    
                    Private m\_clientName As String
                    ''' <summary>
                    ''' The full display name to use for the client
                    ''' </summary>
                    Public ReadOnly Property ClientName As String
                        Get
                            Return m\_clientName
                        End Get
                    End Property
                    
                    
                    Private m\_enabled As Boolean = True
                    ''' <summary>
                    '
                    
                    N Offline
                    N Offline
                    Nagy Vilmos
                    wrote on last edited by
                    #15

                    VB? I see why you're ashamed!

                    veni bibi saltavi

                    D 1 Reply Last reply
                    0
                    • N Nagy Vilmos

                      VB? I see why you're ashamed!

                      veni bibi saltavi

                      D Offline
                      D Offline
                      Duncan Edwards Jones
                      wrote on last edited by
                      #16

                      expected ';' ;P

                      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