Laura's Questions Flashcards
Difference between abstract class and interface
Both:define methods and properties
Abstract: can only extend to one class can have method bodies or properties Interface: implement as many as needed but cant have method bodies or fields
Difference between stack and heap
Stack - not flexible and responsible for handling what you are executing in your code, memory management is LIFO, cheaper and faster than heap,
Heap - is dynamic memory allocation, keeps track of your objects, slower than stack
Static Access Modifier
Static - attributes and methods belong to the class instead of the object
Difference between overriding and overloading
Overloading same method name with different parameters (better performance than overriding
Overriding - a subclass or child class to change function of a method that is already provided by a parent class
difference between array and array list
Array - fixed length, collections of the same data type
Array List - can store different data types and is not a fixed length
How are strings different from other data types
Strings are immutable so if if it needs changes it will need to be reassigned
*What is pass by reference?
Pass by value means to pass a copy of the variable to the method. Pass By Reference means passing access to the variable to the method. the variable of a reference type contains a reference to its data. Variable of a value type contains its data directly
A reference parameter is a reference to a memory location of a variable. When you pass parameters by reference, unlike value parameters, a new storage location is not created for these parameters. The reference parameters represent the same memory location as the actual parameters that are supplied to the method.
*Singletons
creational design pattern that lets you develop one persistent instance throughout an application
ensures only one object of its kind exists and provides a single point of access to it,
What different testing in software can you tell me about
Unit - test for small piece of code, like a method
Integration - units are integrated and tested together to confirm all parts are working cohesively
Functional - establishs whether each feature works per the software requirements/end user’s expectation
End-to-End - verifies the functionality and performance of an entire software application from start to finish simulating real-world user scenarios and replicating live data
Performance - determine stability, speed, scalability & responsiveness of applications
Test Driven Development - test cases are created before code is fully written
== vs .equals()
both compare objects on their equality but == comparison operator and .equals() method compares the contents of a string
Key Principles of OOP
Inheiritance - parent/child classes, implicitly extends the object class (root of all classes) giving the same attributes and methods to the child class, car > civic and limo
Encapsulation - class is an example, bundles data and methods that work on data in one unit, SSN in bank transaction as needed
Polymorphism - One thing that can be many things, animal - makenoise/move cat vs dog
Abstraction - principle to some, similar to encapsulation, isolate the interface of a class from its implementation and focus on the interface
dependency injection
allows for inversion of control between classes and their dependencies, reduces tight coupling between software components
Client Class: The Client Class (dependent class) is a class that depends on the Service Class. That means the Client Class wants to use the Services (Methods) of the Service Class.
Service Class: The Service Class (dependency) is a class that provides the actual services to the client class.
Injector Class: The Injector Class is a class that injects the Service Class object into the Client Class.
It allows a programmer to remove hard coded dependencies so that the application becomes loosely coupled and extendable. design pattern that implements inversion of control using the dependencies from the class (interfaces of the classes in our case, the thing the program needs) to inject (or pass into) out class at runtime rather than creating a new one every time it runs. inverts control of the instantiation of dependencies from the class itself to the container. says that you don’t care how the two classes work together, you just put in what you need to make them both work since they sort of rely on each other, which promotes loose coupling, allows one path to retrieve data
client means your implementing component (class)
service(means your dependency/dependencies(another class)
interface means the interface that is used to bridge between your client and service
passing the service to the client rather than allowing a client to build or find the service is the fundamental requirement of the pattern. a client who wants to call some services should not have to know how to construct those services.
In ASP.NET Core you go into the startup file, tell it what interface you want to use and then the concrete implementation of it
Difference between a value /primitive data type and a reference type
Reference types are too big to be saved on the stack so the variable doesn’t save the actual value, it saves the location of the value on the heap.
Value/Primitive types are saved directly on the stack
.NET vs C#
.NET - Framework, has a library of thousands of classes to be used right out of the box
C# - language built and run on .net framework, has specific syntax
Common Classes we use in ADO.NET
Command - ExecuteReader() - returns data to client as rows and used for select
Execute Scalar - returns only a single value returns number of robes or calculated value
Execute Non Query - used for insert update and delete and returns number of rows affected
Data Reader class
Connection Class
Data Adaptor
Data set
ADO.NET
set of classes that expose data access services for .NET Framework devs (relational, XML and application), provides communication between the front end controls and back end database