This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product | |
{ | |
// ... | |
} | |
class Order // работа с заказом | |
{ | |
// ... | |
public void Calculate() { } | |
public void AddItem(Product product) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product | |
{ | |
// ... | |
} | |
class Order | |
{ | |
// ... | |
public void Calculate() { } // работа с составляющими заказа | |
public void AddItem(Product product) { Console.WriteLine("Item was added!"); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PegLeg // деревянная нога | |
{ | |
public string Color { get; set; } // brown will be OK | |
public bool Dirty { get; set; } // yes / no | |
public double Length { get; set; } // inches | |
public int Usability { get; set; } // 0 - 100% | |
public PegLeg() | |
{ | |
Console.WriteLine("Peg Leg C-TOR!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hat | |
{ | |
public string Color { get; set; } | |
public string Model { get; set; } | |
public double Price { get; set; } | |
} | |
class Person | |
{ | |
public string? Name { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
{ | |
public string? Name { get; set; } // ассоциация (поле с типом другого класса) | |
public string? Surname { get; set; } | |
public string SaySomething() // ассоциация (возврат значения с типом другого класса, string) | |
{ | |
string? local = "всем уже привет"; // ассоциация (локальная переменная с типом другого класса) | |
return local; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// как известно, | |
// основная задача проектирования при объектной декомпозиции - это выполнение двух условий. | |
// условия удачной объектной декомпозиции: | |
// - высокое сцепление (high cohesion): максимизация связей внутри классов | |
// - низкая связанность (low coupling): минимизация (ослабление, гибкость) связей между классами | |
// ДЗ на весенние каникулы: | |
// 1) отдохнуть, набраться сил :) | |
// 2) выполнить объектную декомпозицию по отношению к классу Student (код представлен ниже) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student { | |
char* firstname; // имя студента | |
int firstname_length; // сколько символов в имени | |
char* surname; // фамилия студента | |
int surname_length; // сколько символов в фамилии | |
char* lastname; // отчество студента | |
int lastname_length; // сколько символов в отчестве | |
char* country; // страна | |
int country_length; | |
char* region; // область |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <curl/curl.h> | |
#include <string> | |
using namespace std; | |
/* | |
1) заходим на https://github.com/microsoft/vcpkg | |
2) качаем архив (code > download) | |
3) распаковываем архив, переносим файлы в C:\vcpkg | |
4) запускаем bootstrap-vcpkg.bat, в папке сформируется vcpkg.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AndroidManifest.xml: | |
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools"> | |
... | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* вместо AsyncTask был использован Thread для выполнения операций в фоновом режиме в MainViewModel. | |
также, для обновления UI с использованием LiveData, был использован Handler для отправки сообщений в основной поток */ | |
MainActivity.java: | |
package com.sunmeat.async; | |
import android.graphics.drawable.Drawable; | |
import android.os.Bundle; | |
import android.widget.Button; |