70-461: Querying Microsoft SQL Server 2012

I poszedł kolejny. :)
http://www.microsoft.com/learning/en/us/exam-70-461.aspx
Ale tym razem muszę sobie zrobić przerwę.

A po przerwie może jeden z poniższych:
http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-583
http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-487

Clustered and Nonclustered Indexes

A table or view can contain the following types of indexes:
  • Clustered
    • Clustered indexes sort and store the data rows in the table or view based on their key values. These are the columns included in the index definition. There can be only one clustered index per table, because the data rows themselves can be sorted in only one order.
    • The only time the data rows in a table are stored in sorted order is when the table contains a clustered index. When a table has a clustered index, the table is called a clustered table. If a table has no clustered index, its data rows are stored in an unordered structure called a heap.
  • Nonclustered
    • Nonclustered indexes have a structure separate from the data rows. A nonclustered index contains the nonclustered index key values and each key value entry has a pointer to the data row that contains the key value.
    • The pointer from an index row in a nonclustered index to a data row is called a row locator. The structure of the row locator depends on whether the data pages are stored in a heap or a clustered table. For a heap, a row locator is a pointer to the row. For a clustered table, the row locator is the clustered index key.
    • You can add nonkey columns to the leaf level of the nonclustered index to by-pass existing index key limits, 900 bytes and 16 key columns, and execute fully covered, indexed, queries. For more information, see Create Indexes with Included Columns.

http://msdn.microsoft.com/en-us/library/ms190457.aspx

What are the differences between mocks and stubs

  • Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
  • Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example).
  • Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.
  • Mocks are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive.
http://martinfowler.com/articles/mocksArentStubs.html
Some authors[1] draw a distinction between fake and mock objects. Fakes are the simpler of the two, simply implementing the same interface as the object that they represent and returning pre-arranged responses. Thus a fake object merely provides a set of method stubs.
In the book "The Art of Unit Testing"[2] mocks are described as a fake object that helps decide whether a test failed or passed by verifying whether an interaction with an object occurred. Everything else is defined as a stub. In that book, "Fakes" are anything that is not real. Based on their usage, they are either stubs or mocks.
Mock objects in this sense do a little more: their method implementations contain assertions of their own. This means that a true mock, in this sense, will examine the context of each call— perhaps checking the order in which its methods are called, perhaps performing tests on the data passed into the method calls as arguments.
http://en.wikipedia.org/wiki/Mock_object#Mocks.2C_fakes_and_stubs

To put it in a single sentence, mocks are about behavior and stubs are about state. What the hell does that mean you say!? 
A unit test that uses a stub is interested in being able to make a call to an object and getting data back that will allow the method under test the ability to continue with a given set of values. Those values are designed to flex the method’s abilities and see if it succeeds in all the proper test scenarios. So, stubs provide state (data) back to the method under test and your unit test has all the information it needs within itself to determine success or failure. 
Mocks on the other hand are about behavior. Under the current conditions, did my method pass the right values? Did it make all of the right calls and ONLY the calls that were necessary?
http://marknic.net/2010/01/11/mocks-vs-stubs/


 
Tomasz Kulig