Wednesday, 25 September 2019

BDD Vs TDD Vs ATDD

BDD lets organizing software development documentation in a more efficient, more business-like way. Thus business analysts can access information needed much faster and stakeholders see changes implemented much better. Unlike TDD BDD introduces additional details in unit tests.


BDD is an extension of Test-Driven Development (TDD) that emphasizes developing features based on a user story and writing code that provides a solution to real problems.



BDD is largely an extension of the TDD methodology. The developer defines a test case, tests code to verify that the test case will fail. Next, the developer writes the code necessary to pass the test case and then tests the code to ensure compliance.

Where BDD differs from TDD is how the test case is specified. 

BDD tests cases exist in a way that specifies the desired behavior.
The clear language of BDD test cases makes it simple for all stakeholders in a development project to understand.


TDD is a developer-focused methodology that aims to encourage well-written units of code that meet requirements while

ATDD is a methodology designed to promote collaboration among customers, development, and QA to ensure well-designed requirements.

Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle:
first the developer writes an (initially failing) automated test case that defines a desired improvement or new function,
then produces the minimum amount of code to pass that test,


Is TDD agile?

Agile is a philosophy whereas TDD is a specific methodology.


Friday, 16 August 2019

Rebuild vs Reorganize

Rebuild:

An index ‘rebuild’ creates a fresh, sparkling new structure for the index. If the index is disabled, rebuilding brings it back to life. You can apply a new fillfactor when you rebuild an index. If you cancel a rebuild operation midway, it must roll back (and if it’s being done offline, that can take a while).

Reorganize:

This option is more lightweight. It runs through the leaf level of the index, and as it goes it fixes physical ordering of pages and also compacts pages to apply any previously set fillfactor settings. This operation is always online, and if you cancel it then it’s able to just stop where it is (it doesn’t have a giant operation to rollback).

Wednesday, 28 February 2018

python for loop

for loop in python

There are two types of loops in Python, for and while.

The "for" loop
For loops iterate over a given sequence. Here is an example:

primes = [2, 3, 5, 7]
for prime in primes:
    print(prime)


For loops can iterate over a sequence of numbers using the "range" and "xrange" functions. The difference between range and xrange is that the range function returns a new list with numbers of that specified range, whereas xrange returns an iterator, which is more efficient. (Python 3 uses the range function, which acts like xrange). Note that the range function is zero based.

# Prints out 3,4,5
for x in range(3, 6):
    print(x)

Sunday, 25 February 2018

difference between post and put

The HTTP methods POST and PUT aren't the HTTP equivalent of the CRUD's create and update. They both serve a different purpose. It's quite possible, valid and even preferred in some occasions, to use PUT to create resources, or use POST to update resources.

Use PUT when you can update a resource completely through a specific resource. For instance, if you know that an article resides at http://example.org/article/1234, you can PUT a new resource representation of this article directly through a PUT on this URL.

If you do not know the actual resource location, for instance, when you add a new article, but do not have any idea where to store it, you can POSTit to an URL, and let the server decide the actual URL

Wednesday, 29 November 2017

Linq VS stored procedure

1) Stored procedure is a best way for writing complex queries as compared to LINQ.

2) Stored procedures are faster as compared to LINQ query since they have a predictable execution
    plan and can take the full advantage of SQL features.

3) When a stored procedure is being executed next time, the database used the cached execution plan
    to execute that stored procedure.

4) LINQ has full type checking at compile-time and Intellisense support in Visual Studio as compared
    to stored procedure. This powerful feature helps you to avoid run-time errors.

5) LINQ allows debugging through .NET debugger as compared to stored procedure.

6) LINQ also supports various .NET framework features like multi –threading as compared to stored
    procedures.

7) LINQ provides the uniform programming model (means common query syntax) to query the
    multiple databases while you need to re-write the stored procedure for different databases.

8) Deploying LINQ based application is much easy and simple as compared to stored procedures
    based. Since in case of stored procedures, you need to provide a SQL script for deployment but in
    case of LINQ everything gets complied into the DLLs. Hence you need to deploy only DLLs.

9) LINQ query is compiled each and every time while stored procedures re-used the cached
    execution plan to execute. Hence, LINQ query takes more time in execution as compared to stored
     procedures.

10) LINQ is not the good for writing complex queries as compared to stored procedures.

11) LINQ is not a good way for bulk insert and update operations.

12) Performance is degraded if you don't write the LINQ query correctly.

13) If you have done some changes in your query, you have to recompile it and redeploy its DLLs to        the server.

Sunday, 26 November 2017

Select and SelectMany in LINQ


SelectMany: Flattens collections into a single collection (similar to cross join in SQL). It return lists of lists into a single list.

Select: gets a list of lists. So we have to use two nested foreach loops to print the subjects.


// With Select
IEnumerable<IEnumerable<Author>> tmp1 = SampleData.Books.Select(book => book.Authors);
tmp1.Dump("With Select");
foreach (var authors in tmp1)
{
  foreach (var author in authors)
  {
    author.LastName.Dump();
  }
}

// With SelectMany
IEnumerable<Author> tmp2 = SampleData.Books.SelectMany(book => book.Authors);
tmp2.Dump("With SelectMany");
foreach (var author in tmp2)
{
  author.LastName.Dump();
}

var bookAuthors =
  from book in SampleData.Books
  from author in book.Authors
  select author.LastName;

bookAuthors.Dump("With a double from");