The document discusses the roles and responsibilities of a project manager in software development. It covers the software development lifecycle (SDLC), common methodologies like SCRUM, and the differences between projects and products. It also describes the typical project team roles and the key duties and qualities of an effective project manager, such as planning, organizing, leading, controlling, clear communication, managing expectations, and prioritizing the team over oneself.
Integration tests test multiple components together by using dependencies like databases, services, and APIs. They are useful for testing typical workflows and ensuring components interact smoothly but can be hard to write, maintain, and localize errors. UI tests with Selenium automate interactions with a web application like users do in order to detect errors not found by other test types, but take more time and setup compared to unit tests.
The document discusses the roles and responsibilities of a project manager in software development. It covers the software development lifecycle (SDLC), common methodologies like SCRUM, and the differences between projects and products. It also describes the typical project team roles and the key duties and qualities of an effective project manager, such as planning, organizing, leading, controlling, clear communication, managing expectations, and prioritizing the team over oneself.
Integration tests test multiple components together by using dependencies like databases, services, and APIs. They are useful for testing typical workflows and ensuring components interact smoothly but can be hard to write, maintain, and localize errors. UI tests with Selenium automate interactions with a web application like users do in order to detect errors not found by other test types, but take more time and setup compared to unit tests.
This document provides an overview of software quality assurance and testing. It defines quality as meeting specifications and customer expectations. Software testing investigates quality by providing stakeholders information. Testing is important to prevent defects, as shown by examples of bugs that caused spacecraft and airplane failures costing lives and money. Quality assurance focuses on preventing defects through planning and verification, while quality control identifies defects through action and validation. Defects can be costly so issue tracking systems are used to manage bug lifecycles. Manual testing is time-consuming and relies on human resources while automation testing is faster, more reliable and programmable.
This document discusses design patterns, which are general and reusable solutions to common problems in software design. It covers three categories of design patterns: creational patterns, structural patterns, and behavioral patterns. The document also lists some common antipatterns to avoid, such as singleton patterns, spaghetti code, and magic numbers. It recommends some online resources for learning more about design patterns with examples and explanations of when to use specific patterns.
This document discusses best practices for writing clean, readable code. It covers topics like code layout, naming conventions, documentation, code smells, and code reviews. Specifically, it recommends:
- Consistent indentation and ordering for clean layout
- Meaningful naming styles like PascalCase to enhance readability
- Comments to explain difficult code or describe design decisions
- Addressing code smells like long methods or classes that could make code harder to maintain
- Conducting code reviews to improve quality and catch potential bugs
This document discusses code quality tools and metrics. It defines technical debt and introduces various metrics like cyclomatic complexity and Chidamber & Kemerer object-oriented metrics to measure code quality. It also discusses tools like SonarQube and SonarLint that can analyze code and provide metrics and reports on code quality, complexity, technical debt and more. SonarQube allows centralizing these metrics and provides different views like code coverage, issues and files. It also features quality gates.
The document discusses different MV* software design patterns - MVC, MVP, and MVVM. It explains the basic structure of each pattern, including how the view, controller/presenter, and model components interact. It provides examples of each pattern, including links to sample applications. The key benefits of these patterns are also summarized, such as separation of concerns, easier testing, and independence of the UI from business logic.
This document discusses improving proto types when using them in collections for RPC applications. It recommends adding an empty message type for void parameters and repeatable types for data collections. Sample code shows defining request/response messages for getting a user by name including a repeated field for the user collection. The server code returns the collection while the client code iterates over it. Implementing an online shop sample is suggested along with using the template method pattern for server internal logic. The document recommends a design patterns book and thanks the reader.
The document provides an overview of communication capabilities in Android, including networking, useful networking libraries, Bluetooth, and Near Field Communication (NFC). It discusses how to connect to networks, perform network operations on a separate thread, check network connectivity, download data using HTTPURLConnection, and efficiently manage network usage. Libraries covered include Retrofit, okHTTP, Volley, and RoboSpice. The document also provides examples of discovering Bluetooth devices, connecting to Bluetooth devices, and implementing Bluetooth profiles. It concludes with a brief description of NFC technology.
This document provides an overview of best practices for Android Wear development. It discusses how to pair Wear devices, common APIs with Android, showing notifications, distributing Wear apps, defining layouts, accessing views, useful libraries like Gson and EventBus, and other tips.
The document summarizes the SOLID principles of object-oriented design, including the Single Responsibility Principle, Open/Closed Principle, Liskov Substitution Principle, Interface Segregation Principle, and Dependency Inversion Principle. It also discusses Inversion of Control and Dependency Injection, explaining how following these principles helps make software more reusable, extensible, replaceable, loosely coupled, cohesive, and testable. The document provides definitions and examples for each principle and design pattern.
"Elements of functional programming in C# based on Language-Ext library as an...Fwdays
The functional programming elements are increasingly appearing in C# programming language every year. However, there are still elements for which there is no native support in the language. It is not always appropriate or possible to change the language to another, where there are such elements. Based on Language-Ext library as an example, which is widely used in the development by Uklon, we will analyse the most useful and popular elements of functional programming that have been already implemented in this library.
The document provides an overview of Android application development fundamentals including application components, intents, manifest files, and more. It discusses that Android apps are written in Java and compiled to APK files. The core application components are activities, services, broadcast receivers, and content providers. Intents are used to start components and broadcast receivers register to receive system or app events. Every app must declare its components in the Android manifest.
The document discusses Android location and sensor APIs. It provides an overview of location services in Android, which allows apps to access location through the LocationManager. It also discusses the sensors framework, which gives access to motion, position, and environment sensors. It describes how to identify available sensors, register listeners to receive sensor events, and handle the sensor data. Key classes like SensorManager, Sensor, and SensorEventListener are also summarized.
This document provides an introduction to the Java programming language. It discusses the goals of Java, including being cross-platform, providing security through sandboxing with the Java Virtual Machine, and replacing C/C++. It explains what is needed to run and develop Java applications and the differences between Java editions. The document outlines some key differences between Java and C#/C++ and how to write a basic Java application. It also defines JAR files and provides principles for designing class structures in Java.
This document provides instructions for creating a gRPC Hello World sample in C# using .NET Core. It describes creating client and server projects with protobuf definition files. The server project implements a Greeter service that returns a greeting message. The client project calls the SayHello method to get a response from the server. Running the projects demonstrates a basic gRPC communication.
DevOps is a culture and practice that aims to rapidly build, test, and release software. Continuous integration requires developers to integrate code into a shared repository multiple times a day, with each check-in verified by automated builds to detect problems early. Continuous delivery is the practice of releasing every good build to users. Popular tools for continuous integration include TeamCity, Jenkins, and others.
The document discusses the role of a user experience designer, outlining their design process which includes discovering user requirements, creating design concepts and prototypes, validating designs through research and testing, and iterating on their work through collaboration and learning. It emphasizes the importance of an iterative design process driven by user needs.
The document discusses the role of a business analyst in a software project. It explains that a business analyst is involved in requirements gathering and representation. This includes eliciting requirements through preliminary discussions with customers, reviewing requirements with other roles like architects and UX designers, and specifying requirements. Requirements can be represented through user stories, use cases, documents, and other methods. User stories are written from the perspective of users and define what they want to do. Use cases outline interactions between actors and a system. Together, clearly documented requirements help ensure a project delivers business value through the right software solution.
2. • Повинні наслідуватись від System.Exception
• Стандартна обробка помилок в C#
• Викидається коли:
a) код досягає виразу throw
b) виникає системний вийняток (такий як ділення на нуль)
• Не перевіряються вийнятки чи їх специфікації
Вийнятки (Exceptions) в C#
3. • Потрібно викинути екземпляр виключення:
throw(new MyException(“Error”));
• Може бути використана тільки в блоці catch
catch
{
throw;
}
throw statement
4. • Наслідуємо від System.Exception або дочірного класу
public class Exception1 : System.Exception
{
public Exception1(string message) : base(message){}
}
public class SomeException : Exception1
{
public SomeException(string message) : base(message){}
}
Створення класу Exception
5. • Колись вийнятки, визначені у додатку повинні були розширювати
(наслідуватись від ) System.ApplicationException (obsolete)
ApplicationException(obsolete)
6. • Блок catch пов’язаний з блоком try
• Блок try може мати більше ніж один блок catch
• catch блок відловлює тип вийнятку або наслідуваний тип вийнятку
що проходять через:
блоки catch проглядаються в порядку їх появи в коді
блоки catch для специфічних типів повинні іти перед більш
загальними типами
• Порожній блок catch буде виловлювати всі типи
• Блок catch не потребує імені змінної
catch(Exception)
Виловлення вийнятків
8. • Вийняток передається вгору поки він не знайде прийнятний
обробник
void function1()
{
try
{
try
{
throw(new SomeOtherException(“Error Message”));
}
catch(Exception1 ex)
{
}
}
catch(Exception2 ex)
{
}
}
Exception Flow Control
9. • Якщо не буде знайдено підходящого обробника, то вийняток буде
переданий до методу, що викликається
void function2()
{
try
{
Function1();
}
catch(Exception3 ex3)
{
}
catch(Exception2 ex4)
{
}
catch(Exception ex)
{
}
}
Exception Flow Control
10. • Якщо не буде знайдено підходящого обробника, то виконання
програми перерветься і контроль буде передано операційній
системі (Windows)
Unhandled Exceptions
11. • Повинен бути повязаним з try блоком
• try блок може мати тільки один finally блок
• finally блок завжди виконується (але спочатку
виконується відповідний блок catch)
Блок finally
13. •Unhandeled exception в деструкторі
деструктор припиняє виконання, вийняток
нехтується, викликається базовий деструктор
•Catch без параметрів відловить усі
неопрацьовані вийнятки з інших мов
Деякі спеціальні правила
15. • Message –
Повідомлення (string) асоційоване з вийнятком
• InnerException
Якщо вийняток був згенерований всередині обробника вийнятків, це посилає на
оригінальний вийняток
• Source
Посилається на клас – джерело вийнятку
• StackTrace
Текстовий рядок, який представляє стек виклику, файл і номер рядка
System.Exception Class
17. • Структурний шаблон проектування, призначений для динамічного підключення
додаткових можливостей до обєкта.
• Шаблон Decorator надає гнучку альтернативу методу визначення підкласів з метою
розширення функціональності.
Паттерн Декоратор
18. • Завдання
Об'єкт, який передбачається використовувати, виконує основні функції.
Проте може виникнути потреба додати до нього деяку додаткову
функціональність, яка виконуватиметься до або після основної
функціональності об'єкта.
• Спосіб вирішення:
Декоратор передбачає розширення функціональності об'єкта без
визначення підкласів.
• Реалізація
Створюється абстрактний клас, що представляє як початковий клас, так і
нові функції, що додаються в клас. У класах-декораторах нові функції
викликаються в необхідній послідовності — до або після виклику
подальшого об'єкта.
Паттерн Декоратор
20. • Component: абстрактний клас, який визначає інтерфейс для наслідуваних обєктів
• ConcreteComponent: конкретна реалізація компонента, в яку з допомогою
декоратора добавляється нова функціональність
• Decorator: сам декоратор, реалізується в вигляді абстрактного класу і має той ж
базовий клас, що й обєкти що декоруються. Тому базовий клас Component повинен
бути легким і визначати тільки базовий інтерфейс. Клас декоратор також зберігає
посилання на обєкт що декорується в вигляді базового класу Componentі реалізує
звязок з базовим класм через наслідування
• ConcreteDecorstorA і ConcreteDecoratorB надають додатковий функціональності,
якими повинен бути розширений обєкт ConcreteComponent. ConcreteDecorstorA
добавляє нову властивість NewState, а ConcreteDecoratorB добавляє новий метод
NewMethod().
Паттерн Декоратор. Учасники
21. Розглянемо приклад.
Припустимо, у нас є піцерія, яка готує різні типи піц з різними добавками.
Є італійська, болгарська піци.
До них можуть додаватися помідори, сир і т.д.
І в залежності від типу піц і комбінацій добавок піца може мати різну вартість.
Тепер подивимося, як це зобразити в програмі на C #:
Паттерн Декоратор
23. • Парадигма програмування, яка дозволяє виокремити перехресну (наскрізну)
функціональність.
• Часто згадуваним недоліком обєктно-орієнтовного підходу є неможливість локалізації
наскрізної функціональності в одному класі. Як приклад такої функціональності часто
називають необхідність ведення журналів подій, керування винятковими ситуаціями, перевірку
прав доступу. Код, що відповідає за дану функціональність, часто розкиданий по різних класах.
Це, з одного боку, не дозволяє сконцентрувати увагу на основній бізнес-логіці класу і
ускладнює читання коду. З іншого боку, ускладнюється внесення змін у методи роботи
наскрізної функціональності, що не завжди можна виправити правильним використанням
інтерфейсів чи шаблонів проектування.
Aspect Oriented Programming
24. • Аспект ( aspect) — модуль або клас, який реалізує наскрізну функціональність. Аспект змінює
поведінку іншого коду, застосовуючи поради в точках з'єднання, визначених деяким зрізом;
• Порада (advice) — додаткова логіка, код, який повинен бути викликаний з точки з'єднання.
Порада може бути виконана до, після або замість точки з'єднання;
• Ціль ( target) — об'єкт, до якого будуть застосовуватися поради;
• Точка з'єднання (join point) — точка в виконуваній програмі (виклик методу, створення об'єкта,
звернення до змінної), де слід застосувати пораду;
• Зріз (pointcut) — набір точок з'єднання. Зріз визначає, чи підходить дана точка з'єднання до
заданої поради;
• Впровадження (introduction) — зміна структури класу та/або зміна ієрархії успадкування для
додавання функціональності аспекту в чужорідний код;
• Переплетення ( weaving) — зв'язування об'єктів з відповідними аспектами (можливе на етапі
компіляції, завантаження або виконання програми).
Основні поняття
25. Переваги використання
• Аспектно-орієнтований підхід розглядає програмну систему як набір модулів,
кожен з яких виражає особливість функціонування системи.
• При проектуванні системи розробник вибирає модулі так, щоб кожен із них
реалізовував певну функціональну вимогу.
• Аспектно-орієнтований підхід зменшує складність розроблюваного коду
26. Переваги використання
• Аспектно-орієнтований підхід розглядає програмну систему як набір модулів,
кожен з яких виражає особливість функціонування системи.
• При проектуванні системи розробник вибирає модулі так, щоб кожен із них
реалізовував певну функціональну вимогу.
• Аспектно-орієнтований підхід зменшує складність розроблюваного коду
27. • АОП обробляє аспекти, як фреймворки компонентів. Він використовує щось, що називають
аспектною обгорткою, щоб вставити наші аспект-методи в наші класи під час компіляції.
• Проте, C # приходить з обгорткою аспекта аспектом.
• C # є гібридом процедурної та об'єктно-орієнтовної мов програмування.
• Таким чином, ми повинні наслідувати АОП з використанням комбінації спеціальних класів,
просторів імен і інтерфейсів.
Aspect Oriented Programming С#
28. • Ми повинні наслідувати наші АОП класи з ContextBoundClass.
• Клас ContextBoundClass дозволяє нам створювати компоненти АОП, через змогу розширення
.Net Framework для надання метаданих для наших компонентів.
public class ContextClass: ContextBoundObject { }
• Ми додаємо наші метадані до цього класу, де ми повинні реалізувати наші методи аспект.
• В C #, ми створюємо наші аспект модулі як класи атрибутів.
ContextBoundClass
29. • Як бачите нижче, наші класи атрибутів матимуть свої власні атрибути. У нашому прикладі
атрибут AttributeTarget контролює застосування атрибута класу / методу / властивості і так далі.
ContextBoundClass
31. • Замикання (англ. Closure) - це процедура, яка посилається на вільні змінні в своєму лексичному
контексті.
• Замикання, так само як і екземпляр об'єкта, є спосіб представлення функціональності та даних,
пов'язаних і упакованих разом.
• Замикання (closures) представляють собою фрагменти (блоки) коду, який можна
використовувати в якості аргументів функцій і методів
• Ідея замикань полягає в доступі анонімного методу не тільки до переданих параметрів, а й до
зовнішнього оточення.
Замикання (Closures)
32. Замикання (Closures)
private void EnclosingMethod(bool outerVariable1,
ref int nonOuterVariable)
{
int outerVariable2 = 10;
string capturedVariable = "captured";
if (outerVariable2 % 2 == 0)
{
int normalLocalVariable = 5;
Console.WriteLine("Normal local variable: {0}", normalLocalVariable);
}
WaitCallback d = delegate(object o)
{
int anonymousMethodLocalVariable = 12;
Console.WriteLine("Captured variable is {0}", capturedVariable);
};
ThreadPool.QueueUserWorkItem(d, null);
}
33. Поведінка зохоплених змінних
Ще однією важливою особливістю реалізації замикань в
мові C # є те, що при замиканні здійснюється
захоплення змінної, а не захоплення значення змінної,
яке було перед визначенням делегата.
34. Поведінка зохоплених змінних
var funcs = new List<Func<int>>();
for (int i = 0; i < 3; i++)
{
funcs.Add(() => i);
}
foreach (var f in funcs)
Console.WriteLine(f());
var funcs = new List<Func<int>>();
for (int i = 0; i < 3; ++i)
{
int tmp = i;
funcs.Add(() => tmp);
}
foreach (var f in funcs)
Console.WriteLine(f());
38. Рекомендована література
1. R. Sedgewick “Algorithms”
2. A. Troelsen “C# 6.0 and the .NET 4.6 Framework”
3. H. Schildt “C# 4.0 The Complete Reference”
4. J. Richter “CLR via C#”
5. J. Skeet “C# in Depth”
6. Stackoverflow.com
Editor's Notes
#31: private static IEnumerable<int> GetFibonacciNumbers(int maxValue)
{
int previous = 0;
int current = 1;
while (true)
{
int next = current + previous;
if (next <= maxValue)
{
previous = current;
current = next;
yield return next;
}
else
{
yield break;
}
}
}
#36: private static IEnumerable<int> GetFibonacciNumbers(int maxValue)
{
int previous = 0;
int current = 1;
while (true)
{
int next = current + previous;
if (next <= maxValue)
{
previous = current;
current = next;
yield return next;
}
else
{
yield break;
}
}
}
#37: private static IEnumerable<int> GetFibonacciNumbers(int maxValue)
{
int previous = 0;
int current = 1;
while (true)
{
int next = current + previous;
if (next <= maxValue)
{
previous = current;
current = next;
yield return next;
}
else
{
yield break;
}
}
}