Category: .Net

State design patterns, when to use, pros and cons

The state design scheme is used to model changes in the state or state of an object by delegating the rules for such changes to individual objects representing each possible state.

When we should use the state model?

The state model is a good candidate to apply when you have an object with a relatively complex set of possible states, with many different business rules on how state transitions occur and what should happen when the state changes.

If the object is merely a state-owned property, at any time, any state can be updated with at least special logic, the State Schema increases needless complication. However, for the objects representing the real world concepts, with a compound workflow, the state structure can be a decent option.

What are the Advantages of using this model?

The state model minimizes conditional complexity, eliminating the need for if and switch statements on objects that have different behavioral requirements that are unique to different state transitions. If you can represent the state of the object using a finite state machine diagram, it is easy enough to convert the diagram into the types and methods of the state design model.

What are the Disadvantages of using this model?

The state schema requires a large amount of code to be written. Depending on the number of different defined state transition methods and how many possible states an object can have, you can quickly write dozens or more different methods. For N states with M transition methods, the total number of methods required will be (N + 1) * M. In the previous example for an insurance policy, there are 5 different states, each of which must define 5 methods (ignoring for the moment the ListValidOperations method), for a total of 25 methods in the state types. Thus, the type of policy context must also define the 5 methods of state transition, for a total of 30 methods to be written.


Few Tips to Secure your Servers

Regarding your infrastructure, your primary concern is usually to get and manage your applications. However, apps are not going to work properly without fulfilling the security requirements of your infrastructure. There may be serious consequences in the future.

We will converse various simple security means that need setting or configuring for the top configuration setting.

Check site activity and archive records in a safe place.

Security professionals know the importance of maintaining server activity logs. Since most web servers are for the public, it is important to perform this work for all internet-based services. These audits help detect and respond to the trail attacks and help resolve server performance issues. In high security environments, be sure to store files in a physically safe place – the safest (but the least easy) way to be the line printer, when the path is printed, the path is printed, and then its record Makes it The permanent card cannot be converted by Entrychrinter which has no physical access at workspace. You also want to consider using electronic equality, such as access to the secure host, which is encrypted with a digital signature to prevent entry and record.

Use the application scanner.

If it is accessible, you can enter the internal entry using the application scanner to enter the internal code. AppScan and Hacking tools can help ensure that the exploitation code is not to avoid the trees and the environment of production.

Set the frame for SSH Configuration

One of the most common services is almost SSH on almost all servers. While in the past, managers have sent everything using tools such as a telephone (including passwords!) Via simple text, SCH encryption connection between you and your server. Although it self-improvement in security, unfortunately, it is not enough. In this section, we have some basic SCH hardness techniques that should be used on all of your servers.

Disable Root Login

The easiest things you can do is disable the root record to save a layout setting. After this chapter, we will talk about how to prevent access to road access from Sud Utility (and some default system of viewpoint), in this case, we are as root, password, security keys Talking about limiting the ability to log in. Or any other way. Because of the root user’s power, it is safe to overcome the possibility that the invaders can get access to the administrator’s direct access. Instead, the administrators must log in as a common user and then use a local component like Sudo to become root.

SSL / TLS encryption

You can use an SSL certificate or TLS certificate to verify that the companies are different from each other. After verification, they can also be used to create encryption connections. Each server can be configured to trust a central certification authority. After that, any testimony in which the power signal can be collected. If applications and protocols are used to connect TLS encryption / SSL support, this system is encryption method without which the van tuning is maximum (often used indirectly). Goes)


Advantages of NoSQL Database over RDBMS

The NoSQL database is a data loading approach different from the relational database. NoSQL’s differences are considered as an additional chart and document, key-value, column, to name.

MongoDB is schematic of less.

  • It is a database of documents in which a collection contains different documents.
  • There may be a difference between the number of fields, the content and the size of the document from one to another.
  • The structure of a single object is clear in MongoDB.
  • There are no complex combinations in MongoDB.
  • MongoDB offers an in-depth query function because it supports a powerful dynamic query in documents.
  • It is very easy to climb.
  • Use internal memory to store work sets and this is the reason for quick access.
  • Load balancing and Sharding

If you have a lot of data or want to distribute your database traffic between multiple machines to load, there are many advantages of Mongo DB in traditional databases. In addition, shading, which has a unique approach to Mango D to meet data development needs, uses a horizontal scale and allows multiple machines to support database development.

What About Flexibility

All elements in their use do not require unified data structures in nature. It is much simpler than RDBMS. On the other hand, the constant stability of data is very important and, in general, it’s a good thing, so we recommend using a unified data structure.

What about Performance 

Since all figures are usually in one position, Mongo DB is very fast. However, it’s just when you’re working on a document. If you work in data dependency, the code should run multiple free queries to recover individual documents and slow down the RDBMS.


SQL interview questions part 1

What is SQL function?

SQL functions are methods which accept parameters and perform the action, such as a complex calculation and return the result of that action as a value.the return value can either be a single scalar value ,result set. We can’t use a function to Insert, Update, Delete records in the database table(s).

Available types of functions in SQL.

  1. Scalar Functions
  2. Table-Valued Functions
  3. System Function

What is the stored procedure?

Stored Procedures are pre-compiled objects which are compiled for the first time and its compiled format is saved which executes whenever it is called.

Difference between SQL function and Stored procedure?

  1. A function must return a value but in Stored Procedure, it is optional( Procedure can return zero or n values).
  2. Functions can have only input parameters for it whereas Procedures can have input/output parameters.
  3. Functions can be called from Procedure whereas Procedures cannot be called from Function.
  4.  The procedure allows SELECT as well as Insert, Update, Delete statement where Function allows only SELECT statement.
  5. Procedures cannot be utilized in a SELECT statement whereas Function can be embedded in a SELECT statement.
  6. Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section whereas Function can be.
  7. Inline Function can be thought of as views that take parameters and can be used in JOINs and other Rowset operations.
  8. We can handle Exception by try-catch block in a Procedure but not in functions.
  9. We can perform Transaction Management in Procedure whereas we can’t go in Function.

Can we call the Stored procedure inside SQL function?

No, You cannot execute a stored procedure inside a function, because a function is not allowed to modify database state, and stored procedures are allowed to modify database state.

Can we call a function inside the Stored procedure?

Yes, We can call functions inside the stored procedures.

Is Row_Number generate duplicate Id?

No, ROW_NUMBER  Returns a unique number for each row starting with 1. For rows that have duplicate values, numbers are arbitrarily assigned.

what is Scope identity in SQL?

Scope_Identity returns the last identity value generated in the current scope (i.e. stored procedure, trigger, function, etc).

What is CTE in SQL?

A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.




Domain model in Domain driven design

Hello everyone, In this article, we will focus on the Domain model an foundation of Domain Driven Design.

Domain Model is a term you will hear a ton of Domain Driven Design. I think Domain Model is a standout amongst the clearest cases of phrasing that implies literally nothing unless you comprehend the setting to which it applies.

In the present article, we will take a gander at what Domain Model really implies, why it is critical and how to utilize it in the setting of your improvement ventures.

The Domain is the problem

Domain Driven Design is predicated around taking care of the issues associations look through the code. This is accomplished by centering the speculation of assets into the core of the business rationale of the application.

The area in this way is the universe of the business. At whatever point you hear the expression “Area Driven Design”, you should consider it “Business Problem Driven Design”.

The area is the universe of the business you are working with and the issues they need to explain. This will ordinarily include standards, forms and existing frameworks that should be incorporated as a feature of your answer.

Space is the thoughts, information, and information on the issue you are attempting to settle. Most organizations will have terms that include particular significance inside the setting of their association. They will likewise likely have measurements, objectives, and destinations that are one of a kind to their business.

The Model is your solution

The Model of a Domain Driven Designed task is your answer to the issue.The Model more often than not speaks to a part of reality or something of intrigue. The Model is additionally frequently a disentanglement of the master plan thus the essential parts of the arrangement are focused on while everything else is disregarded.

This implies your Model ought to be engaged learning about a particular issue that is disentangled and organized to give an answer.

The Domain Model

So if the Domain is the world of the business, and the Model is your solution, what is the Domain, Model?

The Domain Model is your composed and organized information of the issue. The Domain Model ought to speak to the vocabulary and key ideas of the issue area and it ought to distinguish the connections among the greater part of the elements inside the extent of the space.

The Domain Model itself could be an outline, code cases or even composed documentation of the issue. The critical thing is, the Domain Model ought to be available and justifiable by everybody who is included in the venture.

The Domain Model ought to likewise characterize the vocabulary around the undertaking and should go about as a specialized instrument for everybody included. The Ubiquitous Language is a critical idea in Domain Driven Design thus it ought to be specifically gotten from the Domain Model.

One of the destructions of numerous product improvement ventures is the misconception of terms, targets and proposed arrangements that are checked toward the start of advancement.

The Domain Model should go about as a reasonable portrayal of the issue that is being comprehended and the proposed arrangement. It is critical that all partners of the task add to the Domain Model with the goal that everybody comprehends the key ideas and meanings of the vocabulary of the venture and how the issue is being handled and tackled.