Skip to content

hzAhmed5/Computer-Science

 
 

Repository files navigation

Learning C# (Basics, Algorithms, Design Patterns, Data Structures, SOLID)

"I am not afraid of a person who knows 10000 kicks. But I am afraid of a person who knows one kick but practices it for 10000 times." - Bruce Lee

Contents


Introduction to Computer Programming

Object Oriented Programming

Refer to https://kolosovpetro.github.io/cs/oop/

Algorithms

Refer to https://kolosovpetro.github.io/cs/data_structures_and_algorithms/

  • Search Algorithms (and their benchmark measurement)
    • Linear Searches
    • Binary Search
  • Sort Algorithms
    • Bubble sort O(n^2)
    • Cocktail sort (Buble 2 pass sort) O(n^2)
    • Counting sort O(n+k), k = non negative terms count
    • Insertion sort O(n)
    • Merge sort O(n*log(n))
    • Quick sort O(log(n))
    • Selection sort O(n^2)
  • Coin Change Problem (Intro to Dynamic programming)
  • RPN Calculator (postfix calculator based on stack data structure)

Data Structures

  • Implemented data structures are

  • To be implemented in future

    • Priority Queue
  • What's used

    • NUnit UnitTest Framework
    • Generics
    • Indexers
    • IEnumerable interface implementation

Design Patterns

Refer to website: https://refactoring.guru/design-patterns

  • Creational
    • Factory Method (Extends functionality of program)
    • Abstract Factory
    • Builder (Avoiding huge number of parameters withing object's consturctor. Combination of parameters.)
    • Prototype (Deepcopy of class)
  • Structural
    • Decorator (Combines required functionalities)
    • Bridge
  • Behavioral
    • Observer (Defines interaction between two or more classes)
    • Strategy (Extends functionality of program)

SOLID

A set of principles recommended to follow in order to maintain business applications. Contains examples of both convinient and unconviniet examples

  • Single Responsibility Principle - Do one thing, but do it best
  • Open-Closed Principle - App. should be open for extension, but closed for modification. Usually, solved by pattern Strategy
  • Liskov Substitution Principle - Proper abstractization, where all subclasses correctly implements methods from base class
  • Interface Segregation Principle - Clients should not be forced to depend upon interfaces that they do not use.
  • Dependency Inversion Principle
    • High-level modules should not depend on low-level modules. Both should depend on abstractions.
    • Abstractions should not depend on details. Details should depend on abstractions.

ADO .NET

Work in PostgreSQL data base through ADO .NET

Refer to https://kolosovpetro.github.io/cs/data_bases_2/01_NpgSQL.pdf

Notes

  • Query which reterns data: ExecuteReader()
  • DML DDL :ExecuteNonQuery()
  • SQL injection protect: Parameters.AddWithValue("param", var);
  • While using Parameters do not use place variable between '', eg dont do '@var'

Git Simple Pull Request

Example of simple pull request and other related activities.

Contains

  • Simple pull request guide
  • How to untrack files from gitignore (apply gitignore file)
  • How to keep forked repo up to date with remote

Visit: https://github.com/kolosovpetro/Computer-Science/tree/develop/Simple%20Pull%20Request

Computational Methods

  • Numerical Sys. Converter (Pure example how to break all SOLID rules in 1 class, DO NOT WRITE CODE THIS WAY)
  • System of Linear Equations Solver
  • Polynomial Interpolation (Vandermonde method)
  • Discrete Integration (Simpson's, Trapezoidal methods)
  • Monte Carlo Method (Estimation on the plan finishing time)

Misc

Other projects.

  • Database Control Panel. Simple winforms app in order to perform SQL queries on PostgreSQL Database. Not protected from SQL injections.
  • LINQ. A set of custom methods in order to operate over IEnumerable collections.

To do list

  • Unite all Data Structures under single library
  • Write documentation and comments for Design Patterns
  • For all design patterns generate class diagrams
  • Write various extensions for IEnumerable, structs, classes
  • Add README files to various projects

Useful Links

Notes

  • Values vs Reference type: In oder to modify reference type (e.g class) via method it is enought to

      static void Modify(int[] a)
      {
      	a[0] = 5;
      }
    

    However, in case of value types (e.g structs) method variable should be supplies with ref keyword in order to modify entire variable

      static void Modify(ref int a)
      {
      	a = 5;
      }
    
  • In order to work with class library, all its classes must have acessor public. E.g public class1 { }.

  • Constant fields const are static and cannot be acessed using this reference.

  • Single responsibility principle can be threaten as partial case of Interface segragation principle, where current class implements only one interface.

  • In case of useage of Inherritance it is essentially important to follow Liskov Substitution Principle in abstract design.

About

Computer science, Algorithms, Data Structures, OOP, Design Patterns, SOLID

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C# 100.0%