CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 27

Thread: What are some books and tutorials that focus on larger scale OO refactoring and desig

  1. #1
    Join Date
    Sep 2017
    Posts
    26

    Question What are some books and tutorials that focus on larger scale OO refactoring and desig

    I believe most tutorials only lightly cover the concepts of larger abstractions of OO system designs and it's theory . Most seem to lecture more about the concepts of SMALLER abstractions of OO system designs and it's theory.



    So I guess I'm saying it would be SO helpful and awesome to see or read lectures about , not only smaller OO system design and it's theory, BUT ALSO bigger architectural level.

    I've skimmed through a few books on refactoring and the book, "Refactoring in Large Software Projects" by Martin Lippert and Stephen Roock is almost completely about refactoring the larger aspects of OO systems as opposed to refactoring merely the smaller pieces of systems. Other refactoring books focus much more on the smaller aspects, and, yes, I know the larger is made out of the smaller. If you have a Safari account then maybe you could check out this book. I'm telling you - this book is different than other refactoring books that I've seen.


    So I'm wondering if anyone knows of any books or online tutorials that focus on refactoring and designing of larger scale OO abstractions?

  2. #2
    Join Date
    Feb 2017
    Posts
    567

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Quote Originally Posted by JohnBartle View Post
    Most seem to lecture more about the concepts of SMALLER abstractions of OO system designs and it's theory.
    It's because the same design principles apply to programs of any size. At least that's what I think. The size of the source code doesn't matter.

    In my view what matters is the number of people involved. It defines the size of a program. If it's just the original programmer, alone or as chief programmer in a small close-knit team, the program can be considered small. Then it grows, not with added code but with added programmers.

    So the issue with big programs is not to apply a new set of design principles but how to deal with all people. One recent model is called Agile software development,

    https://en.wikipedia.org/wiki/Agile_...re_development

    and that's what the book you refer to is about really. The authors are organizational consultants. They offer advice on large project management, not on design principles for large code bases (because there aren't any specifically for that). If you look at it this way it's easier to find books on the subject.

    Finally the jury is still out on the benefits of the Agile model. Many consider it just another fad to promote business. I don't know. The principles behind it sound reasonable even though they don't help me design programs,

    http://agilemanifesto.org/principles.html
    Last edited by wolle; August 20th, 2018 at 12:58 AM.

  3. #3
    Join Date
    Aug 2006
    Posts
    232

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Regarding refactoring large systems, I would recommend:
    - Working Effectively with Legacy Code
    - The Mikado Method

    Regarding design, in C++ you don't have to use a strict object-oriented design, like you are forced to in many other languages. With the power of C++ you can avoid many of the OO weaknesses, which I believe can be crucial in order to successfully build a large system.

    In particular, you can often avoid inheritance and reference semantics that would otherwise make the code hard to reason about, reuse, test and overall less efficient. You can (and should) often use free functions instead of member functions, etc.

    You must also be aware that many books are outdated and don't take advantage of the modern standards. For example, the classic "Design Patterns: Elements of Reusable Object-Oriented Software" book was written using only OO techniques and before there was a C++ standard, so the implementations are very poor by today's standard.

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,267

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    For example, the classic "Design Patterns: Elements of Reusable Object-Oriented Software" book was written using only OO techniques and before there was a C++ standard, so the implementations are very poor by today's standard.
    The 'modern' version of this is "Design Patterns in Modern c++" by Dmitri Nesteruk. See https://www.amazon.co.uk/gp/product/...?ie=UTF8&psc=1
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.7.4)

  5. #5
    Join Date
    Sep 2017
    Posts
    26

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    After having thought about it more. I probably should have titled this post:


    "What are some books and tutorials that focus on architectural scale OO refactoring and design"

  6. #6
    Join Date
    Sep 2017
    Posts
    26

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Quote Originally Posted by wolle View Post
    It's because the same design principles apply to programs of any size. At least that's what I think. The size of the source code doesn't matter.

    From what I think I can tell, it seems like you're right. Smaller design and refactoring principles and patterns apply to architectural scale also, BUT it seems like they don't always perfectly translate though. To be more specific, what does the single responsibility principle or open close principal look like at an architectural level? Also, what do design patterns look like at an architectural level? Are these even remotely applicable at an architectural level?




    Well, I actually have googled about architectural design and refactoring since my original post, and found a little more content that I don't remember finding last time I searched a few years ago. For example, the architectural styles Message bus, Client/server, Layered, MVC. I am still interested if anyone has any good source for architectural design and refactoring though.


    Thanks for answering.
    Last edited by JohnBartle; August 20th, 2018 at 04:27 PM.

  7. #7
    Join Date
    Sep 2017
    Posts
    26

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Quote Originally Posted by TubularX View Post
    You can (and should) often use free functions instead of member functions, etc.
    I can understand using free functions when the class they would otherwise belong to serves less of a purpose than their complication of the code base justifies, but classes help force the organization and structure of programs. The names of classes also help describe the purpose of a function/method to their users.


    What do mean that one should often use free functions? Under what circumstances?
    Last edited by JohnBartle; August 20th, 2018 at 07:32 PM.

  8. #8
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,768

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Quote Originally Posted by JohnBartle
    To be more specific, what does the single responsibility principle or open close principal look like at an architectural level?
    I'd say that at an architectural level, SRP could be along the lines of dividing a large project into smaller subprojects that do one thing and do it well, although that "one thing" is much larger in scope than your typical class or function. At system level we might even be looking at stuff like microservices.

    Quote Originally Posted by JohnBartle
    I can understand using free functions when the class they would otherwise belong to serves less of a purpose than their complication of the code base justifies, but classes help force the organization and structure of programs. The names of classes also help describe the purpose of a function/method to their users.


    What do mean that one should often use free functions? Under what circumstances?
    I'll quote Stroustrup verbatim in his interview answer on designing simple interfaces:
    Quote Originally Posted by Stroustrup
    Another example would be a Date class, where the operations that actually change the day, month, and year have to be members. But the function that finds the next weekday, or the next Sunday, can be put on top of it. I have seen Date classes with 60 or 70 operations, because they built everything in. Things like find_next_Sunday. Functions like that don't logically belong in the class. If you build them in, they can touch the data. That means if you want to change the data layout, you have to review 60 functions, and make changes in 60 places.

    Instead, if you build a relatively simple interface to a Date class, you might have five or ten member functions that are there because they are logically necessary, or for performance reasons. It's hard for me to imagine a performance reason for a Date, but in general that's an important concern. Then you get these five or ten operations, and you can build the other 50 in a supporting library. That way of thinking is fairly well accepted these days. Even in Java, you have the containers and then the supporting library of static methods.

    I've been preaching this song for the better part of 20 years. But people got very keen on putting everything in classes and hierarchies. I've seen the Date problem solved by having a base class Date with some operations on it and the data protected, with utility functions provided by deriving a new class and adding the utility functions. You get really messy systems like that, and there's no reason for having the utility functions in derived classes. You want the utility functions to the side so you can combine them freely. How else do I get your utility functions and my utility functions also? The utility functions you wrote are independent from the ones I wrote, and so they should be independent in the code. If I derive from class Date, and you derive from class Date, a third person won't be able to easily use both of our utility functions, because we have built dependencies in that didn't need to be there. So you can overdo this class hierarchy stuff.
    You can still organise the free functions by using namespaces. It is the function name that describes the purpose of the function; the class name establishes context, but that context can also be established when a class type is a type of a parameter to a function.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  9. #9
    Join Date
    Aug 2006
    Posts
    232

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Quote Originally Posted by JohnBartle View Post
    What do mean that one should often use free functions? Under what circumstances?
    You should use a member function if it maintains the invariant of the class (the meaning of invariant is explained in the interview referred to by laserlight). Otherwise prefer non-member functions.

    If you have a member function that doesn't need the this-pointer, it doesn't really belong in the class (the function shouldn't have an unnecessary dependency on it).

    Your member functions may call free functions to operate on member data, so you can keep the number of member functions at a minimum and as small as possible.
    Last edited by TubularX; August 21st, 2018 at 06:17 AM.

  10. #10
    Join Date
    Aug 2006
    Posts
    232

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Quote Originally Posted by 2kaud View Post
    The 'modern' version of this is "Design Patterns in Modern c++" by Dmitri Nesteruk. See https://www.amazon.co.uk/gp/product/...?ie=UTF8&psc=1
    I haven't read it. Do you recommend buying it? I wasn't convinced by the reviews.

    Here is a video presentation that I find helpful:

    https://www.infoq.com/presentations/...lus-plus-boost

    And another one regarding free functions:

    https://www.youtube.com/watch?v=WLDT1lDOsb4

  11. #11
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,267

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Quote Originally Posted by TubularX View Post
    I haven't read it. Do you recommend buying it? I wasn't convinced by the reviews.
    If you go to the Amazon site, you can get a 'look inside' the book and see the contents and some sample pages. It covers the usual design patterns. It has 303 pages of info (excluding index, contents etc etc) with 25 chapters. Each chapter averages about 9 pages and covers a particular pattern (eg decorator, command, observer, visitor etc). The book makes references to the GoF book (Design Patterns: Elements of Reusable Object-Oriented Software) - eg "This chapter covers two GoF patterns at the same time: Factory method and Abstract Factory". Each chapter usually starts with an example as to why you would need a particular pattern, then provides some simple examples of the particular implementation and a discussion - then followed by any variations on the theme. So Visitor covers Intrusive, Reflective, Acyclic etc. Whilst the 'pattern' and its implementation are discussed, there is no discussion as to the c++ code itself - you are expected to be able to understand the c++ code.

    It comes across to me more as reference notes to lectures and would probably be very useful for someone sitting a written exam on c++ patterns following a class. It would also be useful for someone who knows c++ but hasn't come across design patterns before. However, for anyone who knows design patterns I guess it would come across as fairly superficial. It seems to want to be both a tutorial and a reference but I don't think it outstands as either. Basically, I think, there tries to be too much in too few pages. It seems to take the view that this book will take over the reigns from the GoF book - which it well might - but only because there's nothing better. If the book had been expanded to about 500 pages with lots of detail and reference explanations then I think this could have been a very good book.

    If you need a primer on c++ design patters then this is probably the best there is as a book. At 19 (inc delivery) in the UK it's not overpriced so is probably worth taking a punt on.
    Last edited by 2kaud; August 21st, 2018 at 11:01 AM.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.7.4)

  12. #12
    Join Date
    Feb 2017
    Posts
    567

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Quote Originally Posted by JohnBartle View Post
    To be more specific, what does the single responsibility principle or open close principal look like at an architectural level?
    At the "architectural level" those principles could enter the picture like this for example:

    - All software in this system shall apply the single responsibility principle and the open-closed principle. Therefore each module must specify how .....

    That's what you say at the architectural level of a system. It's about the structure of the system and it has nothing to do with size. All systems have an architectural level even though it's not always made explicit, especially not in small trivial programs.

    Wikipedia has a link describing what takes place at the architectural level and there's even an ISO standard,

    https://en.wikipedia.org/wiki/Software_architecture
    https://en.wikipedia.org/wiki/ISO/IEC_42010

    I know that "architectural" often is used in the sense of "large enterprise scale system". It's okay as long as you're aware of it. Here's an example,

    https://towardsdatascience.com/10-co...l-a0b47a1e9013

    I find it quite amusing that all these so called "architectural" large scale patterns the author presents really are applicable to systems of any size and not just enterprise scale systems. It's because architecture has nothing to do with size, it's about structure and all systems, large and small, have structure and therefore possess an "architectural level".
    Last edited by wolle; August 22nd, 2018 at 04:37 AM.

  13. #13
    Join Date
    Aug 2006
    Posts
    232

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Thank you 2kaud for sharing your thoughts. Considering the title of the book, I think it's fair to expect that the reader knows C++.

    OK, so I've just got hold of a copy and read a few random chapters. I don't think it would be very good as a first introduction to design patterns.

    The classic GOF book had a nice structure with different sections to describe intent, motivation, applicability, implementation and consequences/trade-offs in detail for each pattern. These sections, except for the implementation part, are for the most part still valid today and the real strength of that book.

    From what I read it seems that the new book is mainly focusing on the implementation and lacks the deep explanation that the old pattern sections provided. It can serve well as a complement though and there are some nice ideas and improved implementations.

    However, I think there is still overuse of inheritance. The "Effective GoF Patterns" presentation linked in my previous post show how to avoid inheritance for some design patterns. The result is much fewer classes, less and simpler code and better performance. For example I use the "effective" strategy pattern implementation a lot. Too bad that implementation is not included in the book.
    Last edited by TubularX; August 22nd, 2018 at 06:07 AM.

  14. #14
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,267

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    I'm not a big fan of Apress books in general. I have a few and wouldn't 100% recommend any. IMO many of the recently produced books from the likes of Apress, Packt etc are not in the same standard as those produced by Addison-Wesly in the late 1990's-early 2000's (and their current offerings). These other recent books to me don't seem to have the same depth and detail. Of the 'new' c++ books (excluding those that teach the language) I know, I think I'd be hard pressed to name more than about 4 that I thought were decent.

    IMO the publishers are going for quantity and not quality.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.7.4)

  15. #15
    Join Date
    Feb 2017
    Posts
    567

    Re: What are some books and tutorials that focus on larger scale OO refactoring and d

    Quote Originally Posted by TubularX View Post
    Regarding design, in C++ you don't have to use a strict object-oriented design, like you are forced to in many other languages. With the power of C++ you can avoid many of the OO weaknesses, which I believe can be crucial in order to successfully build a large system.
    None of the larger mainstream languages today with OO support require you to use strict OO design. They all offer a mix of procedural, functional and OO features. It goes for Java, C#, Python, PHP, Swift, Ruby, D, Scala, Lua and many more. None of these languages force you to use a strict OO design. All of them allow you to "avoid many of the OO weaknesses". None is "overall less efficient".

    I like C++ and wouldn't switch it for anything but fair's fair. With "the power of C++" at your disposal there really is not limit to how much you can misuse features and screw up designs. To "successfully build a large system" you really should think twice before using C++. A least if you don't have a team of well-educated experienced bona fide programmers at your disposal.

    So in my view, the key to good design is not the programming language but the well-educated programmer.

    In particular, you can often avoid inheritance and reference semantics that would otherwise make the code hard to reason about, reuse, test and overall less efficient. You can (and should) often use free functions instead of member functions, etc.
    Could you please be more specific. Do you argue that resorting to procedural programming is the key to good design? Is it the C part of C++ that makes C++ such a good choice for design?

    It's easy to use free functions in Java for example, you just put them in a static class. In C++ this would correspond to putting free functions in a namespace.
    Last edited by wolle; August 24th, 2018 at 04:25 AM.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)