Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I like design patterns very much, but I find it difficult to see when I can apply one. I have read a lot of websites where design patterns are explained. I do understand the most of them, but I find it difficult to recognize a pattern in my own situations.
So, that is why I ask this question. Are there any guidelines / alarm bells when to use which design pattern.
For example, if you are doing a switch statement to determine which object you need to create, you probably want to use the factory design pattern. So the switch statement in this case is a 'alarm bell' to use the Factory pattern.
So, do you know more 'alarm bells' to determine a design pattern?
Usually the process is the other way around. Do not go looking for situations where to use design patterns, look for code that can be optimized. When you have code that you think is not structured correctly. try to find a design pattern that will solve the problem.
Design patterns are meant to help you solve structural problems, do not go design your application just to be able to use design patterns.
Learn them and slowly you'll be able to reconize and figure out when to use them. Start with something simple as the singleton pattern :)
if you want to create one instance of an object and just ONE. You use the singleton pattern. Let's say you're making a program with an options object. You don't want several of those, that would be silly. Singleton makes sure that there will never be more than one. Singleton pattern is simple, used a lot, and really effective.
I completely agree with #Peter Rasmussen.
Design patterns provide general solution to commonly occurring design problem.
I would like you to follow below approach.
Understand intent of each pattern
Understand checklist or use case of each pattern
Think of solution to your problem and check if your solution falls into checklist of particular pattern
If not, simply ignore the design-patterns and write your own solution.
Useful links:
sourcemaking : Explains intent, structure and checklist beautifully in multiple languages including C++ and Java
wikipedia : Explains structure, UML diagram and working examples in multiple languages including C# and Java .
Check list and Rules of thumb in each sourcemakding design-pattern provides alram bell you are looking for.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Edit - [Solved]
So recently I have been learning how in integrate MySql Database to Visual C so I tryed finding the documentation to better understand each line of code. I ended up finding its on the MySql website but does not go into much detail.
I then found out through other users questions that some/most of the methods used are actaully inherited from a base interface/class
Example: IDataReader - is the base class
Then programs would inherit from it then make things such as XmlReader and MySqlDataReader
Which can be found here
https://msdn.microsoft.com/en-us/library/system.data.idatareader.aspx
Now here is where my questions starts
How would I have known/figured out where to start looking? If someone did not link me to the exact URL spot how would I have navigated microsofts site to find it in the first place?
What is a ".NET framework" and how would I have known that integrating a database would use it? - It says its Window Based so does that mean different operating system have there own ".Net framework"?
Is it safe to assume if we are trying to combine different applications together they have to have something binding them together hence need of ".Net framework"
MSDN (Microsoft Developer Network) is the umbrella in which all (or at least very most) Microsoft documentation lies. However, this is a huge conglomeration of information, and navigating it is not really an easy thing to give step-by-step instructions for, or even a general overall approach.
What you're facing is a large part "general learning curve", and the other part is a skillset for finding answers, usually starting with google and often ending at StackOverflow or MSDN or various blogs. In time, as the skill grows (and it is very much a skill), you will learn to be skeptical of articles based on various clues, and learn to tell upon reading them whether the author really knew what they were doing (Microsoft's articles themselves aren't without some measure of this variance in quality). Some sites become known as "stay away, they teach bad practices"
"Google-Fu" is an unofficial term that some people use to describe how well they can coerce google into returning relevant information. Often times it's easy, and often times it's quite difficult.
In short, there's no clear answer. Research is a skill to be honed, not unlike programming itself. Start as you are and keep pushing forward, and eventually you'll get a feel for it and get good at it.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
If I've some common functionality that I've to keep in a class, so will I go for static, sealed or abstract class...Does all these types of classes serve the purpose of keeping the common functionality together...where actually the difference lies when I've to go for one
abstract, sealed, static has nothing to do with real time development. It has to do with bring structure within your software, so that the functionality implemented in classes can and should be used in the right way.
After some comments i think this:
I think you can only learn this, by doing it. There isn't a book or epub that will explain you how to do programming. They will show the syntax and some examples. It will be trial and error. Every day you'll face a new challenge.
You'll have to practice it. The best advise is, look what others already created and try to imagine why did they wrote/solve it that way.
I can explain what a static/sealed/abstract class is/does, but it doesn't learn you when to use it.
Back to the question: Define 'real time'.. I think that static/abstract/sealed should NOT be decisive on how you write your 'real-time' software. If you are 'scared' about performance on this level, C# should not be your choise. I would write c++ or if you want a real challenge, try to beat the compilers with asm ;-)
I think you won't measure the 'overhead'
So, use abstract/static/sealed in a right way, so your future collega's/you can read/maintain it.
I use C# for communication (tcp/ip) between a windows computer and a PLC (with delta robots). But it's far from realtime. It's fast enough to keep many robot working with > 100 messages per second.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I asked about this Q format on meta, and the they said that worded correctly, this should be appropriate. This being said, sorry if I still butchered the wording and just in case I'd like to get this across (as was recommended): I'm not looking for opinions on certain things or how they work, rather just the ways it's possible. I don't mean to sound ignorant and I'm truly sorry if I do, it was just suggested to me to say on Meta.
Now for the Q; What just general language at all would be capable of gathering information from public online websites, then putting it in the program where it could be further processed as just any old variable? I'm new to coding and wanted to do this as a little 'introductory' program, to teach myself some new stuff. Problem being, with my idea, I don't even know where to start. Again, I'm not asking for specific ways to do this, I was just curious what languages are capable of doing this at all? I'd prefer to do it in a Visual Studio's language (no preference of which ones), if that's possible.
In short: Are either Visual C#/C++ capable of gathering information online to be further handled within the program? If not, what languages are?
I agree with the comment that this is a complicated first programming task. However, you'll undoubtedly learn something trying it.
If you already had some experience programming in Python, I'd suggest you took a look at http://scrapy.org/doc/ which is a framework (that is, a bunch of classes and other useful tools) which let you write programs to extract information from web pages. Scrapy does let you concentrate on programming by taking care of some of the nasty details involved in parsing web pages.
Another option is to use a javascript framework, maybe something like node.js.
I've done a fair amount of web scraping, and I usually end up using a combination of utilities which clean up web pages and a variety of XSLT processors. I personally find that combination of technology to be easier to deal with; I don't try to use C-family languages until I've basically wrestled the data into shape. But everyone has their own style.
Good luck!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Recently I have been asked in an Interview that: "Can you give an example of a situation where is it necessary to break the Inheritance chain?". I am not very sure if I could follow the question exactly.
Does any such situation exist when we to break the inheritance chain?
I tried google, but didn't get any clues.
A. When we get stupid questions that make no sense.
Inheritance is just a tool for managing and re-using code. Composition is a strong tool that is not part of an "inheritance-chain" so I'm guessing that's an answer they're looking for?
Another possible answer they're looking for is utilizing interfaces. As interfaces don't require an "inheritance chain". They enable you to be a little more flexible with your architecture and step away from strict inheritance "chains".
However the question implies that you have a number of objects that all inherit from one another and for some reason you "break" the chain of inheritance somewhere. There is no "set" reason why you'd do this as each implementation of OOP that addresses a problem is typically unique.
The way the interviewer phrased the question makes little to no sense. It's a bad interview question that wont result in the best answers or necessarily tell you anything about a candidate except that they don't understand your madness either ;).
EDIT: added some "better" questions.
Better questions include:
Q. What is the difference between inheritance and composition?
Q. I have the following class model (one crying out for an interface), can I improve it at all?
Q. I'm re-designing a base class and want to prevent other people from overriding this function. Can I do that?
Q. Is there a problem with calling virtual methods in class constructors, if so, what?
There's this blog post with a good explanation on why you'd want to "break the inheritance chain" (or "seal" your class).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am wondering whether there's a good tutorial that walks you through the development of a full business application that is comparable to the real ones. I have learned the basics of C#, WPF, and programming and web development in general. All the books I have read only shows the syntax and code snippets but very rare shows you the development of a full business application from planning to testing to deployment.
What is the first step when creating a business application using C#/WPF? I know I need to have a plan first. Should I use UML?
What methodologies or techniques should I consider when starting to code. I have read about Domain Driven Design but there is also MVVM patterm. Which one should I use? Should I learn both of them.
I am currently searching for a work in .NET but I really need to know how the developer's workflow in a real life software development team. I have found some books that walks you through the creation of a full software such as Wrox's Problem-Design-Solution books. Does the content of this book comparable to the workflows of a real-life software development?
Thanks a lot in advance and I hope I can find an answer as I am planning to practice my skills to be ready in a corporate environment.
Um, the platform is irrelevant at this point. If you were doing a winform or a web app, would you use UML? If so, then you would also use it in a WPF. If not, fuggedaboutit.
The first step is to careful gather business requirements.
The methodologies or techniques you should consider when starting to code will be handed down to you by the lead of the project. You sound very inexperienced, so the decision will not be up to you, most likely. Every business is different. Heck, every project is different. You may use a different methodology on each of your first 5 projects. Brush up on them, read what you can, but you will always have a learning curve to climb.
You don't need to learn every methodology or paradigm. Learn as you go. Understand the basic premises of a few, especially the standard waterfall, but don't deep dive until you get assigned to a project. Most places I have been don't follow their own methodologies anyway. It's one of those "The Sabbath was made for man, not man for the Sabbath" type things. Organizations will deviate for a slew of reasons.
This is the book I had in college. It has served me well. You car order it for $0.33. Ain't that something. http://www.amazon.com/Software-Engineering-7th-Ian-Sommerville/dp/0321210263/ref=sr_1_25?s=books&ie=UTF8&qid=1342506249&sr=1-25&keywords=software+engineering
Good luck in the field. Just dive in, and work hard. You should be fine.