Examples of Design Patterns used in FOSS [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I've read a lot of good things written about design patterns but am yet to actually look at things in detail. To me, design patterns is just a fancy name for data structures and algorithms. Before I invest any time in more reading, I'd like to see some good examples of design patterns working in real life.
What good examples of design patterns can I find in well-known open source projects?
C++ preferred.
Update: I see the close votes and downvotes. These were expected. If there is an alternative post with answers to my question, please lead me to it. At least leave a reason as to why this post doesn't belong here.

It appears you did not invest enough time into design patterns to truly grasp what they are. I encourage you to read more, because design patterns are not a fancy name for data structures and algorithms; there is barely any link between algorithms and design patterns. Design patterns are "recipes" that help you organize classes and their relationships in a way that makes them easier to reuse.
As for examples, no need to look very far: the STL collection iterators are implementations of the iterator pattern.

Related

Architecture of c++ projects [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I am from JAVA so please please guide me if i am wrong.
In Java we mostly use a singleton class and create all the class objects thought the singleton class.
What about in c++?
I know we can use singleton but mostly while going through most of the stack overflow questions. Most of them says it's not good to use singleton in c++
Can you recommend some book or some project which will be easy to understand?
Whether you're writing in C++ or Java singletons have many, bad implications.
They make it very difficult to test as their static nature preculdes late binding to, say, sway a real database with a stub that's quicker and has fewer depencies.
They also provide a fig leaf for global variables, trying to make them masquerade as a good design decision. Take a look at the alternatives, it'll pay off in a better design. You may want to look into dependency injection for ways to design a more testable system without singletons.

Upgrade to c++11 from c++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm looking for resources on quickly getting a grasp of c++11 features. Searching on Google I did find a number of resources. However, I failed to find a resource which would help a programmer with prior C++ knowledge.
I don't want to start reading hundreds of pages on C++11 features that I already know from C++. The best thing I found was the Wikipedia article on C++11, but still it doesn't have many examples. There are also some good articles explaining a certain feature of C++ (e.g. lambdas). But I couldn't find something that had them all in one place.
Does anyone know any books, links, etc...?
You may start reading here: Elements of Modern C++ Style -- this article from Herb Sutter can be considered as targeted for C++ programmers who start using C++11.
Everything about C++11 at one page is here: C++11 FAQ by Bjarne Stroustrup
I think Bjarne Stroustrup's C++11 FAQ is exactly what you're looking for:
http://www.stroustrup.com/C++11FAQ.html
Visit http://isocpp.org/get-started. It has most of the details anyone could give you here.
Of course, Prof. Stroustrup's homepage (http://www.stroustrup.com/C++11FAQ.html) is also one of the best places to find what you are looking for.

What is Bison and why is it useful? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have been programming for a few years now and have seen the name Bison in passing, but never bothered to ask why it is or why it might be needed. How can Bison effect how I program, can it make my C/C++ code faster?
Bison is a parser generator. It takes it's input in something similar to Backus-Naur notation and outputs code to parse input according to that grammar. It lets you write a parser more easily than you would otherwise. Instead of having to do everything manually, you only have to specify the rules of your grammar and what you want to happen when it matches one of the rules.
GNU Bison is the only Bison related to programming I know of. It won't make your code faster, and it's possible that you won't ever need it in your life. However, learning some compiler theory, or even writing a simple compiler yourself, is a terrific learning experience that does affect the way you program, the way you think about computer programming, and a lot of things like that. If you enjoy formal languages and automata, you'll enjoy compiler theory; if you dislike theory in general, it's probably not for you. If you're interested, there are lots of questions about starting books on Stackoverflow.
Oh and, once in a while a programmer does need some more complicated parsing work and suchlike, and it's a huge boon to know about parser generators, instead of writing everything by hand, following a naive approach.

Encryption algorithm [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Do you know a good encryption algorithm that isn't too difficult to implement in c++ (but neither too easy)?
Look at this wonderful comics on AES. It explains the cryptographic background of the algorithm and you can practice by writing a high-performance implementation of one in different languages.
I think RSA is good as well as pretty much straightforward to implement. You might want to look into it. Another one I would be suggesting which is also straightforward is DES.
Rivest, Shamir and Adleman (RSA)
Data Encryption Standard (DES)
If you're just looking for something to code up for the learning experience, I've always liked the Advanced Encryption Standard. The actual standard document at NIST provides all the detail you need to write and test your code.
I like RC5 for its simplicity. Much easier to implement than e.g. AES, and while not quite as strong, it is still a good cypher.

Free C++ code samples [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I would like to download some code samples (or even full projects) to learn from. The only place I know of is Sourceforge, but I want top-notch, flawless* code. Not to say there is anything wrong with SF but it's a toss up, and I don't want to learn from someones bad habits.
I've been through gametutorials.com and nehe.gamedev.net, but I would prefer to find something that's been done recently with best practices in mind.
*Obviously nothing is going to be perfect
Boost.
You could look at the source of web browsers like Chrome or Firefox.
Use an open source search engine like Koders
Qt is written pretty well.
Everyone's got different ideas of what's top-notch, as there are fundamental design trade-offs with no correct answer (e.g. performance, memory usage, maintainability, reusability/generality, simplicity, clarity, concision, portability...), and one programmer's idea of elegance is another's pompous over-engineering, and yet another's over-simplistic amateurism... :-/.
Boost code is good, but complicated by a different balance of concerns than most application code: generally portability, performance & memory usage, generality, elegance of usage, and minimising misusage are prioritised massively above simplicity, clarity or concision of implementation.
I think you're better off picking some code that does something you're interested in, then in your passion to change it you'll learn see the implications of the design compromises, good and bad. A smaller project where you can rearchitect the solution and experiment with alternatives is great. No substitute for experience.