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. General Programming
  3. C#
  4. Is this an OOP Programme?

Is this an OOP Programme?

Scheduled Pinned Locked Moved C#
csharpvisual-studiooopquestiondiscussion
9 Posts 6 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.
  • N Offline
    N Offline
    nstk
    wrote on last edited by
    #1

    Hello, I recently began working on a project in C# .Net, written in MS Visual Studio 2010, where many things are at least peculiar... All files are in root directory, meaning there are no subdirs. Files include several classes which, in best case, may belong to the same or a similar fact. Even if there is only one Class in a .cs file, it doesn’t always have the same name, meanig for a Class Car the file may have a name Frm_View.cs, in other words completely irrelevant to the class name. Hungarian notation is being used, like in the old MS times. There is an enorm amount of internal, static and both internal static variables and functions. There is no inheritance between classes. There are no interfaces. It seems to me that it is about an old C programm, which has been ported into C#, but only as far as syntax concerns. What do you think?

    A P P N 4 Replies Last reply
    0
    • N nstk

      Hello, I recently began working on a project in C# .Net, written in MS Visual Studio 2010, where many things are at least peculiar... All files are in root directory, meaning there are no subdirs. Files include several classes which, in best case, may belong to the same or a similar fact. Even if there is only one Class in a .cs file, it doesn’t always have the same name, meanig for a Class Car the file may have a name Frm_View.cs, in other words completely irrelevant to the class name. Hungarian notation is being used, like in the old MS times. There is an enorm amount of internal, static and both internal static variables and functions. There is no inheritance between classes. There are no interfaces. It seems to me that it is about an old C programm, which has been ported into C#, but only as far as syntax concerns. What do you think?

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      Based on your comments, your program may follow only very few principles of OOPS (if at all). So I guess you can say its does not follow many OOPS concepts. But them, I guess its very difficult to write a 'perfect' OOP program in any case though.

      Build your own survey - http://www.factile.net

      1 Reply Last reply
      0
      • N nstk

        Hello, I recently began working on a project in C# .Net, written in MS Visual Studio 2010, where many things are at least peculiar... All files are in root directory, meaning there are no subdirs. Files include several classes which, in best case, may belong to the same or a similar fact. Even if there is only one Class in a .cs file, it doesn’t always have the same name, meanig for a Class Car the file may have a name Frm_View.cs, in other words completely irrelevant to the class name. Hungarian notation is being used, like in the old MS times. There is an enorm amount of internal, static and both internal static variables and functions. There is no inheritance between classes. There are no interfaces. It seems to me that it is about an old C programm, which has been ported into C#, but only as far as syntax concerns. What do you think?

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

        If the application is a C# one, then it's Object Oriented - however, it sounds like it's only just OOP. Perhaps we should coin the term A Little Bit OOP (ALBOOP), as it seems to fit.

        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

        CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

        1 Reply Last reply
        0
        • N nstk

          Hello, I recently began working on a project in C# .Net, written in MS Visual Studio 2010, where many things are at least peculiar... All files are in root directory, meaning there are no subdirs. Files include several classes which, in best case, may belong to the same or a similar fact. Even if there is only one Class in a .cs file, it doesn’t always have the same name, meanig for a Class Car the file may have a name Frm_View.cs, in other words completely irrelevant to the class name. Hungarian notation is being used, like in the old MS times. There is an enorm amount of internal, static and both internal static variables and functions. There is no inheritance between classes. There are no interfaces. It seems to me that it is about an old C programm, which has been ported into C#, but only as far as syntax concerns. What do you think?

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

          If there are objects (and all C# programs have them) then it is Object Oriented Programming.

          nstk wrote:

          there are no subdirs.

          That doesn't matter.

          nstk wrote:

          Class Car the file may have a name Frm_View.cs

          That doesn't matter.

          nstk wrote:

          Hungarian notation is being used

          That doesn't matter.

          nstk wrote:

          There is an enorm amount of internal, static and both internal static variables and functions.

          That may be a code smell, but it doesn't mean it's not OOP.

          nstk wrote:

          There is no inheritance between classes

          That's not always required. Using inheritence simply to use inheritence is a code smell too.

          nstk wrote:

          There are no interfaces.

          That doesn't matter.

          nstk wrote:

          It seems to me that it is about an old C programm,

          Quite possibly. But you have to judge the existing program on its own merits (if any).

          L 1 Reply Last reply
          0
          • P PIEBALDconsult

            If there are objects (and all C# programs have them) then it is Object Oriented Programming.

            nstk wrote:

            there are no subdirs.

            That doesn't matter.

            nstk wrote:

            Class Car the file may have a name Frm_View.cs

            That doesn't matter.

            nstk wrote:

            Hungarian notation is being used

            That doesn't matter.

            nstk wrote:

            There is an enorm amount of internal, static and both internal static variables and functions.

            That may be a code smell, but it doesn't mean it's not OOP.

            nstk wrote:

            There is no inheritance between classes

            That's not always required. Using inheritence simply to use inheritence is a code smell too.

            nstk wrote:

            There are no interfaces.

            That doesn't matter.

            nstk wrote:

            It seems to me that it is about an old C programm,

            Quite possibly. But you have to judge the existing program on its own merits (if any).

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

            PIEBALDconsult wrote:

            nstk wrote:

            There is an enorm amount of internal, static and both internal static variables
            and functions.

            That may be a code smell, but it doesn't mean it's not OOP.

            I would agree with most of what you said but regaurding this, a static class can lead an OOP language into being a 'Functional' program (i.e. not OOP). Even though C# is an OOP language it is 'possible' to make a program that is not at all OOP. Same is true the other way around. One can take a non OOp language and mimic OOP concepts. For example you can code in 'C' using OOP principles by doing things like naming your files as your 'objects'. Although the language is not OOP you are following OOP. Think a console app with everything in the main calling only static methods. Sure you could say its part of the 'program' and that is the object. But is it really OOP? I would say no.

            class Program
            {
            static void Main(string[] args)
            {
            //Everything is done through 'Everything'. Is this OOP?
            //No because, even though Everything is Object based and Everything is itself an object it is used like 'Functional' programming
            }

                static class Everything
                {
                    public static void DoStuff()
                    {
                    }
            
                    public static void DoOtherStuff()
                    {
                    }
            
                    public static void AndEvenMoreStuff()
                    {
            
                    }
            
                    public static void WhereAmI()
                    {
            
                    }
            
                    public static void ISeemToBeLost()
                    {
            
                    }
            
                    public static void OKThisIsRidiculous()
                    {
            
                    }
            
                    public static void IThinkYouMadeYourPoint()
                    {
            
                    }
                }
            }
            

            Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

            N 1 Reply Last reply
            0
            • N nstk

              Hello, I recently began working on a project in C# .Net, written in MS Visual Studio 2010, where many things are at least peculiar... All files are in root directory, meaning there are no subdirs. Files include several classes which, in best case, may belong to the same or a similar fact. Even if there is only one Class in a .cs file, it doesn’t always have the same name, meanig for a Class Car the file may have a name Frm_View.cs, in other words completely irrelevant to the class name. Hungarian notation is being used, like in the old MS times. There is an enorm amount of internal, static and both internal static variables and functions. There is no inheritance between classes. There are no interfaces. It seems to me that it is about an old C programm, which has been ported into C#, but only as far as syntax concerns. What do you think?

              N Offline
              N Offline
              nstk
              wrote on last edited by
              #6

              Thanks for your replies. I am aware that C# an OOP language is. I am also aware that it is not obligatory to have inheritance or interfaces. But in this case everything is against an OOP design. And if every function in a programme can change every variable in it, then imho it has nothing to do with OOP, although in it's syntax there are always classes, since otherwise it wouldn't compile. I wrote this message because I wanted to get a feedback from the forum, since I plan to write to my boss that this piece of code is worthless and should be rewritten with a new concept. As a matter of fact, we are being confronted with all these problems that are described in the software enginnering literature since years. We always deal with a lot of bugs and problems, no one is completely sure of what is happening, we have not a complete picture of the structure, we are steadily debugging step by step hoping to find out what changed that variable at the last moment(because any class can do that) and even the person who did program it and recently made some changes, had to search for some unexpected new errors that arose. I think it's time to get rid of that piece of software for the simple reason that it is not as OOP designed. Any objections?

              L J 2 Replies Last reply
              0
              • L Lost User

                PIEBALDconsult wrote:

                nstk wrote:

                There is an enorm amount of internal, static and both internal static variables
                and functions.

                That may be a code smell, but it doesn't mean it's not OOP.

                I would agree with most of what you said but regaurding this, a static class can lead an OOP language into being a 'Functional' program (i.e. not OOP). Even though C# is an OOP language it is 'possible' to make a program that is not at all OOP. Same is true the other way around. One can take a non OOp language and mimic OOP concepts. For example you can code in 'C' using OOP principles by doing things like naming your files as your 'objects'. Although the language is not OOP you are following OOP. Think a console app with everything in the main calling only static methods. Sure you could say its part of the 'program' and that is the object. But is it really OOP? I would say no.

                class Program
                {
                static void Main(string[] args)
                {
                //Everything is done through 'Everything'. Is this OOP?
                //No because, even though Everything is Object based and Everything is itself an object it is used like 'Functional' programming
                }

                    static class Everything
                    {
                        public static void DoStuff()
                        {
                        }
                
                        public static void DoOtherStuff()
                        {
                        }
                
                        public static void AndEvenMoreStuff()
                        {
                
                        }
                
                        public static void WhereAmI()
                        {
                
                        }
                
                        public static void ISeemToBeLost()
                        {
                
                        }
                
                        public static void OKThisIsRidiculous()
                        {
                
                        }
                
                        public static void IThinkYouMadeYourPoint()
                        {
                
                        }
                    }
                }
                

                Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                N Offline
                N Offline
                nstk
                wrote on last edited by
                #7

                That exactly is my point.

                1 Reply Last reply
                0
                • N nstk

                  Thanks for your replies. I am aware that C# an OOP language is. I am also aware that it is not obligatory to have inheritance or interfaces. But in this case everything is against an OOP design. And if every function in a programme can change every variable in it, then imho it has nothing to do with OOP, although in it's syntax there are always classes, since otherwise it wouldn't compile. I wrote this message because I wanted to get a feedback from the forum, since I plan to write to my boss that this piece of code is worthless and should be rewritten with a new concept. As a matter of fact, we are being confronted with all these problems that are described in the software enginnering literature since years. We always deal with a lot of bugs and problems, no one is completely sure of what is happening, we have not a complete picture of the structure, we are steadily debugging step by step hoping to find out what changed that variable at the last moment(because any class can do that) and even the person who did program it and recently made some changes, had to search for some unexpected new errors that arose. I think it's time to get rid of that piece of software for the simple reason that it is not as OOP designed. Any objections?

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

                  You can write object oriented code in C, and you can write mostly non-object oriented code in C#. But C is still not an object oriented language, and C# still is. So when you asked "is it OOP?" then what does that even mean? And also, does it matter? So that program may or may not be "proper OOP design", but are you sure that's a problem? Would it help if it were? OOP is not a silver bullet that magically solves all problems - indeed it often creates new ones. If there is a problem with maintainability of the code, then there is a problem with the maintainability of the code. Whether it's object oriented or not doesn't necessarily imply there is a problem with the maintainability of the code, and if both are true at the same time anyway, that does not necessarily make the non-OOP-ness the cause of the problem. TL;DR: if there is a problem with the code, fix it. If it's not OOP designed but there is no problem, why fix what isn't broken?

                  1 Reply Last reply
                  0
                  • N nstk

                    Thanks for your replies. I am aware that C# an OOP language is. I am also aware that it is not obligatory to have inheritance or interfaces. But in this case everything is against an OOP design. And if every function in a programme can change every variable in it, then imho it has nothing to do with OOP, although in it's syntax there are always classes, since otherwise it wouldn't compile. I wrote this message because I wanted to get a feedback from the forum, since I plan to write to my boss that this piece of code is worthless and should be rewritten with a new concept. As a matter of fact, we are being confronted with all these problems that are described in the software enginnering literature since years. We always deal with a lot of bugs and problems, no one is completely sure of what is happening, we have not a complete picture of the structure, we are steadily debugging step by step hoping to find out what changed that variable at the last moment(because any class can do that) and even the person who did program it and recently made some changes, had to search for some unexpected new errors that arose. I think it's time to get rid of that piece of software for the simple reason that it is not as OOP designed. Any objections?

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

                    nstk wrote:

                    I wrote this message because I wanted to get a feedback from the forum, since I plan to write to my boss that this piece of code is worthless and should be rewritten with a new concept.

                    Err..no. You have some code that is unlikely to have an Object Oriented design. That however doesn't make it "worthless". If the code is being used in the business then it is far from "worthless". If it isn't being used then it shouldn't be changed at all.

                    nstk wrote:

                    We always deal with a lot of bugs and problems, no one is completely sure of what is happening, we have not a complete picture of the structure, we are steadily debugging step by step hoping to find out what changed that variable at the last moment(because any class can do that) and even the person who did program it and recently made some changes, had to search for some unexpected new errors that arose.

                    Now those are problems. And those are problems that OOP will NOT fix. However there are other practices that if put into place MIGHT fix those problems. Those practices can be applied to a OO and structured app. In certain cases it might be easier to apply them to OO code. But not necessarily. It might the case that the code is badly implemented and thus it is more cost effective to rewrite it. However based on the problems listed above a rewrite MUST insure that the same problems are not allowed to exist with the rewritten code.

                    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