I must study politics and war that my sons may have liberty to study mathematics and philosophy. My sons ought to study mathematics and philosophy, geography, natural history, naval architecture, navigation, commerce and agriculture in order to give their children a right to study painting, poetry, music, architecture, statuary, tapestry, and porcelain. – John Adams
In a multithreaded application, one thread would spawn another thread to do the fetching and waiting while the parent thread continued to do other work. When the data was needed, the parent thread was blocked waiting for the spawned thread to finish its work.This pattern is known as fork-join pattern.
Except for the main thread, all the threads mentioned so far are background threads. When you create a new thread, you have the option to specify if the thread should be a background thread.
When the main thread and all other nonbackground threads of a .NET application finishes, the .NET application finishes as well.
Multicore and many-core are both used to describe systems with more than one core, but there is a difference between them. Multicore refers to CPUs that have several cores of the same type on the same silicon chip. Many-core refers to CPUs that have different kinds of specialized cores on the same silicon chip.
The Csharp Players Guide 2nd Edition(RB Whitaker)——2016-9-9
In fact, even if you know you’re the only person who will ever see your code, you should still put comments in it. Do you remember what you ate for lunch a week ago today? Neither do I. Do you really think that you’ll remember what your code was supposed to do a week after you write it?
It’s easy to write code. It’s hard to write code that you can actually go back and read and understand.
When making a real program, you should use the pre-existing one, instead of making your own.
Difference between value types and reference types: When you have a variable that is a value type, the actual contents of that variable live where the variable lives. With a reference type, the contents of the variable live on the heap, and the variable itself contains only a reference to the actual content.
While we cover a lot of ground in this chapter, this is the end of the beginning.
Classes will outline three general categories of things: the data it has (as variables) the things it can do (methods) and ways to create or setup new instances of the class (constructors).
I always tell people that class design is one part science, one part art, and one part black magic.
The science comes from learning basic principles and rules that tend to lead to better overall design(see the entire discipline of software engineering).
The art comes from practice and experience. After creating 10000 classes, you’ll have a natural, intuitive sense of what will work and what won’t.
The black magic part comes from the fact that no matter how much you know and how experienced you are, you’ll still get it wrong sometimes. Especially as you develop a program and try to add features you had never thought of. Fortunately, software can easily be refactored and rearranged from the wrong organization to the right organization.
There’s no such thing as getting it right all the time, so don’t beat yourself up when you do. That applies to both beginners and professionals. Just change it to make it work like you think it should and keep moving forward.
Readability and understandability should always be a priority over using cool new language features.