C#-SQL Flashcards
Test-driven development (TDD)
is a software development process relying on software requirements being converted to test cases before software is fully developed, and tracking all software development by repeatedly testing the software against all test cases. This is as opposed to software being developed first and test cases created later.
- Mantra: Red, Green, Refactor
- Structure: Arrange, Act, Assert
Code Coverage
It is the percentage given to you on how much lines of your code is actually covered by unit testing
* Ex: Lets say you have a total of 200 lines of code and your unit testing only covers 70 lines of code. That means you have 35% code coverage (Fancy math - 70/200*100 = 35%)
SDLC
- Phases of SDLC -> Requirement Analysis, Design, Development, Testing, Deployment, Maintainence
- Waterfall, Bing Bang Model, RAD, Spiral Model, Iterative, Agile (Scrum), TDD
Logging
* The systematically way to record a series of events depending on what exactly you are trying to capture dotnet add package Serilog.Sinks.File 2. create a Logger using LoggerConfiguration class provided by Serilog 3. Start logging!
Testing
- Black-box, white-box testing
- Performance Testing, Load Testing, Smoke testing, Integration Testing, Penetration Testing, Unit Testing.
Unit Testing
is important component of developer testing which is heavily used in TDD.
- In.Net/.Net Core supports multiple frameworks for testing
- MSTest, NUnit, xUnit.
Generally Supported Code Coverage Formats
- Supported code coverage report format types include all test coverage reports we’ve seen in the wild so far, including:
- Most of .xml format types (Cobertura XML, Jacoco XML, etc.)
- Most of .json format types (Erlang JSON, Elm JSON, etc.)
- Most of .txt format types (Lcov TXT, Gcov TXT, Golang Txt)
LINQ
- Language-Integrated Query
- It is a query language that is very similar to our SQL but we can use it in C# or VB
- So like any query langauge, it is incredibly useful for filtering/acquiring/aggregating data
- Very useful documentation click here
Method syntax
(LINQ) It is more like C# in that you use methods to perform the queries
* For simple filtering, I would use method syntaxes
Query syntax
(LINQ) It is more like SQL in that you create a statement-like operation using keywords
* I would use joins with query syntaxes since it is easier to understand
SOLID PRINCIPLES
Enables us to manage most of the software design problems, intended to make software designs more understandable Single Responsibility Open Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle
SINGLE RESPONSIBILITY PRINCIPLE
~A class should only have one reason to change Every module or class should have RESPONSIBILITY over a single part of the functionality provided by the software, ~responsibility should be entirely ENCAPSULATED By the class (Persistence, Validation, Error Handling, Logging, Notification, Class Selection/Instantiation, Formatting, Parsing, Mapping, etc...)
OPEN CLOSED PRINCIPLE
Software entities should be open for extension but closed for modification
Design & writing of code should be done in a manner that allows new functionality to be added with minimum changes in the existing code
Allows adding of new functionality as new classes keeping as much existing code unchanged
LISKOV SUBSTITUTION PRINCIPLE
Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program
if the program module is using a base class, then the reference base class can be replaced with a derived class without affecting the functionality of the program module
Derived types must be substitutable for their base types
Normalization
Returns a new string whose binary representation is in a particular Unicode normalization form. Arranging and managing data that returns a new string whose binary representation is in a particular Unicode normalization form.