Timeline for Limitations of using classes as interface
Current License: CC BY-SA 4.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 28, 2018 at 6:31 | vote | accept | calofr | ||
| May 25, 2018 at 20:22 | comment | added | esoterik | @calofr coursera.org/learn/object-oriented-design lmgtfy.com/?q=object+oriented+design+crash+course | |
| May 25, 2018 at 6:32 | comment | added | calofr | @esoterik for programming already did. Can you suggest any course or book for design? | |
| May 24, 2018 at 19:23 | comment | added | esoterik | I think you are in need of a crash course in object oriented design and programming. | |
| May 24, 2018 at 15:18 | comment | added | Robert Harvey | I say this with the caveat that your classes should probably be "smaller" than the smallest of your original programs, and should each have a single purpose or theme. Note that the use of a header file to establish an API is not all that unusual. Also note that shared ("free") functions are very easy to implement in C++, and have a very high degree of cohesivity if they are written properly (input to output, no side-effects). | |
| May 24, 2018 at 15:17 | answer | added | BobDalgleish | timeline score: 1 | |
| May 24, 2018 at 15:17 | comment | added | Robert Harvey | My limited experience with C++ restricts my ability to provide a comprehensive answer, but it seems to me that your guiding principle should be to treat your classes as small programs. Then you can have all the "global variables" and "standalone functions" you want; they will just be contained inside your classes. If you need some dependency from the outside that the class requires (including a mutex), pass it in as a parameter into the constructor of your class. If you need to pass something to the outside world, return it from a member function of the class. | |
| May 24, 2018 at 15:13 | review | Close votes | |||
| May 29, 2018 at 3:02 | |||||
| May 24, 2018 at 14:52 | history | edited | BobDalgleish | CC BY-SA 4.0 | Fixed spelling and grammar, added inline code formatting. |
| May 24, 2018 at 14:28 | review | First posts | |||
| May 24, 2018 at 19:23 | |||||
| May 24, 2018 at 14:26 | history | asked | calofr | CC BY-SA 4.0 |