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 / C++ / MFC
  4. Sharing without seeing the code, possible?

Sharing without seeing the code, possible?

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionsecurityhelplearning
10 Posts 5 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.
  • J Offline
    J Offline
    Joe Smith IX
    wrote on last edited by
    #1

    This is not a coding question, but related to Visual C++. Here is the situation. I am planning to employ several programmers to help me coding. Is there any way to let them add new classes/dialogs/resources without seeing the implementation of my existing classes/dialogs/resources? Of course I want them to be able to use my classes (the main/base classes), but I don't want them to have the whole code (which I wrote for several years) for security and other reasons. I would appreciate any suggestions or ideas. Thanks.

    J realJSOPR 2 Replies Last reply
    0
    • J Joe Smith IX

      This is not a coding question, but related to Visual C++. Here is the situation. I am planning to employ several programmers to help me coding. Is there any way to let them add new classes/dialogs/resources without seeing the implementation of my existing classes/dialogs/resources? Of course I want them to be able to use my classes (the main/base classes), but I don't want them to have the whole code (which I wrote for several years) for security and other reasons. I would appreciate any suggestions or ideas. Thanks.

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #2

      If you have interfaces (pure virtual classes which do define neither member variables nor any implementation or classes which map their interface on your implementation-classes in your code, you can give them only that. But as you ask here you probably have neither. Maybe you can get away with giving them a "cleaned up" version of the headers, with any variable declaration and private function removed as an interface. That way, they could include your code as a closed-source-lib. Or these guys set up their own set of mock-objects using your interface?


      Failure is not an option - it's built right in.

      J 1 Reply Last reply
      0
      • J jhwurmbach

        If you have interfaces (pure virtual classes which do define neither member variables nor any implementation or classes which map their interface on your implementation-classes in your code, you can give them only that. But as you ask here you probably have neither. Maybe you can get away with giving them a "cleaned up" version of the headers, with any variable declaration and private function removed as an interface. That way, they could include your code as a closed-source-lib. Or these guys set up their own set of mock-objects using your interface?


        Failure is not an option - it's built right in.

        J Offline
        J Offline
        Joe Smith IX
        wrote on last edited by
        #3

        I don't quite get "cleaned up" header approach. Don't I still need to give them the .cpp files so that they can compile the whole project? I never created a .lib before (but used many). Is there really a way to give them just the .h files without the .cpp, just like a .lib does? This is really what I am going for: they can see the header, but not the implementation. P.S.: in the "cleaned up" approach, I simply move the variable declaration and private functions to .cpp file? Thanks for any help.

        J D 2 Replies Last reply
        0
        • J Joe Smith IX

          I don't quite get "cleaned up" header approach. Don't I still need to give them the .cpp files so that they can compile the whole project? I never created a .lib before (but used many). Is there really a way to give them just the .h files without the .cpp, just like a .lib does? This is really what I am going for: they can see the header, but not the implementation. P.S.: in the "cleaned up" approach, I simply move the variable declaration and private functions to .cpp file? Thanks for any help.

          J Offline
          J Offline
          jhwurmbach
          wrote on last edited by
          #4

          All my musing about possibilities was nothing for the short-term. But with a (more or less) limited amount of work, you probably could form your code into a library. The interface of that library needs to be a working c++ header file with all variables and private members. Maybe that is OK with you. If you think your contarctors would get too much information from seeing the variable types you defined, you need to go one step further. Add an Interface-header, which declares a abstract base class. You (or them) would then have to implement a "mockup-implementation" of this interface. This may be (probably is) a large amount of work. That way, they could program against the interface, with only you putting the code together. In the "cleaned" approach, as many private functions as possible are moved out of the class to an anonymous namespace at the top of the cpp-file. As your contractors never get to see the content of the cpp-file, you are hiding this code from them. Functions in an anonymous namespace are effectivly static members, and from my experience, an astounding amount of non-trivial static functions could be made static.


          Failure is not an option - it's built right in.

          J 1 Reply Last reply
          0
          • J jhwurmbach

            All my musing about possibilities was nothing for the short-term. But with a (more or less) limited amount of work, you probably could form your code into a library. The interface of that library needs to be a working c++ header file with all variables and private members. Maybe that is OK with you. If you think your contarctors would get too much information from seeing the variable types you defined, you need to go one step further. Add an Interface-header, which declares a abstract base class. You (or them) would then have to implement a "mockup-implementation" of this interface. This may be (probably is) a large amount of work. That way, they could program against the interface, with only you putting the code together. In the "cleaned" approach, as many private functions as possible are moved out of the class to an anonymous namespace at the top of the cpp-file. As your contractors never get to see the content of the cpp-file, you are hiding this code from them. Functions in an anonymous namespace are effectivly static members, and from my experience, an astounding amount of non-trivial static functions could be made static.


            Failure is not an option - it's built right in.

            J Offline
            J Offline
            Joe Smith IX
            wrote on last edited by
            #5

            Yup, i think that's the best solution here: to change my code into a library. Although this only "hides" the code that doesn't deal with dialogs/resources, correct? Thanks a lot.

            J 1 Reply Last reply
            0
            • J Joe Smith IX

              Yup, i think that's the best solution here: to change my code into a library. Although this only "hides" the code that doesn't deal with dialogs/resources, correct? Thanks a lot.

              J Offline
              J Offline
              jhwurmbach
              wrote on last edited by
              #6

              You can have a lib that is opening dialogs. But then the project using the lib has to include the libs rc-file: In the Studio resource-view, right-click on the "PROJECTNAME.rc" and select "resource include" to enter the line #include "lib-resource-file.h in the upper and #include "lib-resource-file.rc" in the lower box. Most often, the rc-files do not contain anything special.


              Failure is not an option - it's built right in.

              J 1 Reply Last reply
              0
              • J jhwurmbach

                You can have a lib that is opening dialogs. But then the project using the lib has to include the libs rc-file: In the Studio resource-view, right-click on the "PROJECTNAME.rc" and select "resource include" to enter the line #include "lib-resource-file.h in the upper and #include "lib-resource-file.rc" in the lower box. Most often, the rc-files do not contain anything special.


                Failure is not an option - it's built right in.

                J Offline
                J Offline
                Joe Smith IX
                wrote on last edited by
                #7

                Cool, a perfect solution then. Thanks a lot.

                M 1 Reply Last reply
                0
                • J Joe Smith IX

                  I don't quite get "cleaned up" header approach. Don't I still need to give them the .cpp files so that they can compile the whole project? I never created a .lib before (but used many). Is there really a way to give them just the .h files without the .cpp, just like a .lib does? This is really what I am going for: they can see the header, but not the implementation. P.S.: in the "cleaned up" approach, I simply move the variable declaration and private functions to .cpp file? Thanks for any help.

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  Joe Smith IX wrote:

                  Is there really a way to give them just the .h files without the .cpp, just like a .lib does?

                  Yes.


                  "A good athlete is the result of a good and worthy opponent." - David Crow

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                  1 Reply Last reply
                  0
                  • J Joe Smith IX

                    Cool, a perfect solution then. Thanks a lot.

                    M Offline
                    M Offline
                    Mark Salsbery
                    wrote on last edited by
                    #9

                    This can be helpful when using Visual Studio to manage multiple resource files: TN035: Using Multiple Resource Files and Header Files with Visual C++[^] Especially the part about resource IDs :) Mark

                    Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

                    1 Reply Last reply
                    0
                    • J Joe Smith IX

                      This is not a coding question, but related to Visual C++. Here is the situation. I am planning to employ several programmers to help me coding. Is there any way to let them add new classes/dialogs/resources without seeing the implementation of my existing classes/dialogs/resources? Of course I want them to be able to use my classes (the main/base classes), but I don't want them to have the whole code (which I wrote for several years) for security and other reasons. I would appreciate any suggestions or ideas. Thanks.

                      realJSOPR Offline
                      realJSOPR Offline
                      realJSOP
                      wrote on last edited by
                      #10

                      Compile your code into a DLL and export the classes. They'll see the method prototypes, but won't see the code behind them. One thing to consider is that you MUST provided complete documentation for the classes so the programmers know how to use them properly.

                      "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

                      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