3

I have a cpp project which source code I want to split into 3 groups and want to define structure for these files by creating folders with nice name.

First group are files related to socket communication. These files contains implementation of company protocol used over the UDP socket. In future there will be another interface implementation over HTTP. It is some kind of interface to the cpp application. Therefore I named it interface.

Second group are files which implement wrapper over 3rd party library + some business logic. I want to name it according to 3rd party library. Reason is because may be in future we will support also other 3rd party libs - so we can have better source code organization.

Third group is currently only one file which contains main. I have not created folder for that and just place it into project folder. This file is connecting necessary pieces from interface folder and 3rd_party_lib_name folder.

+-demo-app
    +-interface
    |    UDPSocketImpl.cpp
    |    UDPSocketImpl.hpp
    +-3rd_party_lib_name
    |    WrapperOf3rdlib.cpp
    |    WrapperOf3rdlib.hpp
    |    BusinessLogic.cpp
    |    BusinessLogic.hpp
    | DemoAppMain.cpp

My question:

What do you think about the project folder structure and names?

5
  • 2
    I think you should google "c++ folder structure" first. Besides that, folder structure in C++ projects is pretty much opinionated.
    – Doc Brown
    Apr 20, 2017 at 10:53
  • @DocBrown Yes I could, but exactly I wanted to know opinion of others. When new member of the team look at the structure I want that he/she has good idea about what and where can be found. Therefore I ask if it is clear enough for other people, not just for me :) But you are right, I will check also what google says.
    – sfelber
    Apr 20, 2017 at 12:49
  • The problem is, the SE sites are not discussion boards, they are Q&A sites. Questions with the intention of "gathering opinions", where no "correct" answer exists, will typically be closed by the community as "primarily opinionated" or "too broad". Have a look into this meta post.
    – Doc Brown
    Apr 20, 2017 at 13:22
  • @DocBrown Hmm, I have not realized that, sorry about that. Should I remove the question? EDIT: I mean not remove but set answered?
    – sfelber
    Apr 20, 2017 at 13:25
  • I think you should delete your question, though it is not badly written, it could others give an excuse for asking more of such questions.
    – Doc Brown
    Apr 20, 2017 at 13:37

1 Answer 1

1

That sounds fine.

I wouldn't worry too much about this. Being thoughtless about the structure is a problem. But as long as you come up with something organized in a reasonably logical way, which would be understandable to others, you should be fine.

This isn't something where perfectionism is likely to be worth it, especially on what seems like a small project.

3
  • without an explanation, this answer may become useless in case if someone else posts an opposite opinion. For example, if someone posts a claim like "That doesn't sound fine. It would be right to worry about this.", how would this answer help reader to pick of two opposing opinions? Consider editing it into a better shape, to meet How to Answer guidelines
    – gnat
    Apr 20, 2017 at 10:59
  • 2
    @gnat fair enough. Edited
    – user82096
    Apr 20, 2017 at 11:10
  • @dan1111 Thanks, I guess I will considered as correct answer.
    – sfelber
    Apr 20, 2017 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.