0% found this document useful (0 votes)
4 views

Programming

The document covers essential programming topics including web protocols, .NET framework, Razor Pages, Blazor, XML, JSON, and various design patterns. It also discusses API architecture, microservices, DevOps principles, and hardware basics. Additionally, it includes examples of programming logic and mathematical concepts like the Fibonacci sequence and prime numbers.

Uploaded by

Tarso Coelho
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Programming

The document covers essential programming topics including web protocols, .NET framework, Razor Pages, Blazor, XML, JSON, and various design patterns. It also discusses API architecture, microservices, DevOps principles, and hardware basics. Additionally, it includes examples of programming logic and mathematical concepts like the Fibonacci sequence and prime numbers.

Uploaded by

Tarso Coelho
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

PROGRAMMING: ESSENTIAL TOPICS

Tarso Luiz Lopes Coelho

1. Web

DNS (Domain System Name): dedicated servers to locate and translate IP numbers and internet
addresses.
FTP (File Transfer Protocol): organize the data transference between client and server on the internet.
IP (Internet Protocol): machine identification in the web.
TCP (Transmission Control Protocol): enables the computers to share messages within the web, dividing
data into packages.
TCP-IP Protocol: combination of TCP and IP protocols.
Hypertext: multimedia content transmitted on the internet.
HTTP: hypertext transfer protocol.
HTML: hypertext creation language. Nowadays, separation of logic (or interactivity, Javascript) semantic
(content) and style (css).
www: “World wide web”, global server's web of hypertext content.

2. How does it work?

Client → Provider → Server


Data is transferred by small packages. Provider is the company that intermediates (provides) the client
internet access. The domain is the site name and “.com”, “.br", etc. are servers.

3. HTTP Requesting

Structure: verb, resource (endpoint), host (domain), access credential (token, optional).

GET: getting data.


POST: sending data.
DELETE: deleting data.
PUT: updating data.

Response codes:

200/299 Success
1/199 Information
300 Redirect
400 - 499 Client error (ex. 400 Bad request, 402 Unauthorized, 403 Forbidden 404 Not Found).
500 - 599 Server error (ex. 500 Internal server error, 504 Timeout).

.NET Api requesting, classes from 4.5 version or higher: WebRequest, WebResponse, HttpClient,
RestRequest.
4. .NET

Once called .NET Framework and .NET Core. We are, currently, at .NET 9 and C# 13. .NET also
supports F# (science, data) and VB.NET. Includes ASP.NET, Windows Form, WCF (Windows
Communication Foundation), Blazor Pages, Scaffolding tools, Garbage Collector, etc.

Each supported language is, first, (1) compiled into an intermediate language (IL), and, second, (2) the
JIT (just-in-time) compiler translates IL into native machine code.

The core of how things work is the CLR (Common Language Runtime), the .NET execution environment
that provides essential runtime services as (1) memory management (ex. Garbage Collector), error
handling, interoperability (unmanaged code calling), multi-treading and parallelism.

5. Razor Pages

Web framework within ASP.NET that simplifies building dynamic rendered web applications. Designed
to be page-focused and only server-side. Combines hml with embedded C# code by means of .cshtml
files. The javascript logic runs client-side.

6. Blazor

Similar to Razor Pages, it also uses razor syntax, normally adopted in SPA (Single Page Application)
projects. Offers more reusability, a client-side running option (Blazor WebAssembly), and, finally,
minimizes JS usage.

7. XML

Acronymous to “Extensible Markup Language”, a metadada storage language. Turns complex data
transferer easier.

Example:

<Person>
<Name>Ronald Wesley</Name>
<Age>12</Age>
<Siblings>
<Sibling>
<Name>Gina</Name>
<Age>11</Age>
</Sibling>
<Sibling>
<Name>Fred</Name>
<Age>13</Age>
</Sibling>
<Sibling>
<Name>George</Name>
<Age>13</Age>
</Sibling>
</Siblings>
<Sons/>
</Person>

8. JSON

Acronymous to “Javascript Object Notation”, a pattern widely adopted for data sharing. Used in Rest
APIs. Many languages have native support to threat it’s files, as serialization (object → data) and
deserialization (data → object) functions. The objects are gathered into trees, and each branch is called a
node.

Example:

{
"Name": "Ronald Wesley",
"Age": 12,
"Siblings": [
{
"Name": "Gina",
"Age": 11
},
{
"Name": "Fred",
"Age": 13
},
{
"Name": "George",
"Age": 13
}
],
"Sons": null
}

9. AJAX and JQuery

Acronymous to “Asynchronous Javascript and XML”, a methodological usage of javascript and xml
technologies, provided by browsers to turn web pages more interactive by means of asynchronous data
requesting. JQuery is a small Javascript library that makes html manipulation, ajax calls and event
handling way easier.

10. IIS

A Microsoft web server to host websites, web applications and services. Often used as a local server for
debugging in Windows environment. Supports ASP.NET, PHP, etc.

11. AWS (Amazon Web Services)

Cloud computing platforms that offer services such as storage, databases, and AI. Competitors: Azure,
Google Cloud, etc.

12. SOLID

1. Single Responsibility
2. Open Closed
3. Liskov Substitution
4. Interface segregation
5. Dependency Inversion

13. API Architecture Patterns: SOAP (Simple Object Access Protocol) and REST (Representational
State Transfer)

An API is an “Application Programming Interface”, a set of code that can be requested for another
program as a service. API Rest: an API that uses the http protocol in its 1.1 version or superior.

SOAP only allows xml communication and POST to request sending. Rest is simpler and lighter than
SOAP and implements many HTTP verbs. A “RESTful API” is an API that respects the Rest rules as:
(1) client-server and stateless design; (2) implementing cache usage, layer system and a uniform interface.

More flexible and easier to implement. Uses both xml and json. In both architectures, the SSL (Security
Sockets Layer) usage and encrypted data transmission are important to hide sensitive information and
reduce vulnerability.

14. Design Patterns

Singleton, dependency injection, TDD, DDD and MVC. Dependency injection uses, mostly, functions
as AddScoped<T> and AddTransient<T>.

About TDD (Test Driven Design): cherish unitary tests for each new functionality developed. In each
code update, test the program consistency.

About Singleton: uses the resource of an instantiated class like a static member in any part of the code
(global access). Reduces dependence and increases code reusing. Example: when using classes that are
very requested as open connectors, services, API integrators and processes that demand authentication.
The singleton class, differently from static classes, can, as an instance, be passed in methods. It can
inherit and implement interfaces. Static classes, however, only implement static members.

namespace Singleton
{
class Manager
{
internal static Manager Instance;
private Manager() { }
private Manager GlobalAcess => Instance ?? (Instance = new Manager());
}
}
15. Bootstrap

The most popular front-end (html, css and javascript) framework for mobile-first responsive websites.

16. Clean Code

Concept by Robert Martin Cecil, a code that cherishes performance, extensibility and clarity.

17. Clean Architecture

Concept by Robert Martin Cecil, an architecture “business rule”- oriented. In it, components are classes
logically or structurally associated (in .NET, separated in projects or assemblies). The Business Rule is
the highest policy level and the most important element of the application. Everything else is peripheral,
such as databases, frameworks, and languages. The dependency arrows have to point from the basic
components to the business layer. The business layer classes have to be protected.

The architecture has to increase the software lifetime. Data-entity modeling is the most important activity
along the development, because it provides stability. The architecture has to communicate the system
design goals.

The program has to be agnostic regarding UI (forms, web pages, etc.), database devices, and framework.
High policy components don’t have to know the implementing details. An entity is nothing more than an
object that incorporates the essential rules of the system, sometimes an abstraction of a real thing.

18. Agile x Traditional (cascade) methods

The traditional method cherishes end-to-end requirements mapping. Focused on the planning. The agile
number one rule is a testing and prototype. Often divided into sprints with daily meetings, it usually
involves a multidisciplinary team.

19. Microservices x Monolithical development

A microservices architecture cherishes component creation that shares the product functions. Each
component runs independently, as services. It helps to separate responsibility and organize the entire
process.

20. Middleware

Software that behaves as a bridge between two other applications.

21. C# 13

Dynamics, anonymous objects, multithreading and parallel resources.

22. OOP (Object-Oriented Programming) Paradigm


Polymorphism, inheritance and overflow.

23. API’s Authentication

Basic and bearer tokens, JWT. The Bearer option is better because the credentials don't navigate in the
header of the request. Less coupling, no cookies, etc. OWIN (Open Web Interface for .NET), another
authentication tool.

24. Entity Framework

It's an ORM (Object-Relational Mapping), a technique that simplifies interactions between object-
oriented languages and relational databases. Allow mapping entities in both directions. In EF, it works
with 2 main classes: DbContext and DbSet<T>. The DbContext encapsulates the database connection
session, allowing to select and save database transactions, and also defines the DbSets, entities that will
compose the database model system. Finally, it keeps the configuration options. In a few words, it’s a
middle field between application and database.

25. Docker

Concept of infrastructure as software. A set of tools, as a service, that uses OS-level virtualization to
deliver software in packages, by his turn called “containers.” Allows developers to package applications
and their dependencies into lightweight and isolated units. It’s used to ensure consistency across
developing, testing and production environments. For example, it creates reproducible environments that
mirror production. Simplifies continuous integration and deployment by automating build, test and
deployment pipelines. Work with images (docker files) in the host. In the container, it can have an OS, a
database, applications… everything useful.

26. SQL and NoSQL

SQLServer, MySQL, Oracle, Postgree and SQLite are not databases. They are, actually, data providers.
They can be called DBMS (Database Management Systems) or SGBD (in French). Likewise, they are,
actually, an interface of communication that allows us to query and transact in databases. Databases are,
at last, files: .db (SQLite) .ibd (MySql), .mdf (SQLServer ). Other topics: joins, normalization rules,
calling query order, subselects, triggers, views and indexes. The more normalization, the less
performance. A View works like a denormalized table. NoSQL is more flexible by decoupling domain
and database schema, although it provides less security. Examples: MongoDb, Apache Cassandra and
Firebase (Google). Derived from key-value models, they are harder to perform complex queries.

27. Heap e Stack

Places to alocate memory when executed by a program. “Stack overflow”, when there is too much
memory allocation on the stack. Stack allocates value types as constants, structs, etc. Pointers are memory
addresses, and a reference is just a shortcut to a pointer.
28. Encoding: ASCII, UTF8 and Unicode

Encoding formats are patterns that associate bytes and characters.

29. .dll and .exe

Dynamic link library (dll). Data and resources that can be executed for more than one program at the
same time. Execution format (exe). That one talks directly to the OS, native binary adapted to the
processor architecture.

30. Compilation and Interpretation

Source code → executable code (assembly). The .NET JIT (just-in-time) makes this happen.

Compiled languages: C, C++, etc. Interpreted: Javascript, PHP, etc. C# and Java are, actually,
precompiled languages, that are executed by a virtual machine (computing environment that functions
as an OS within the OS). Compiled languages require specific compilers for each OS. It generates an
executable compatible with each OS. In this kind, the CIL (Common Intermediate Language) is generated
by the CLR (Common Language Runtime) for each OS. It’s called double compilation and works in two
steps.

31. Microservices

Processes, servers, and programs that connect to a network gate and opens IP sockets accepting TCP
connections, and offer the HTTP protocol. This communication involves compression and serialization.

32. Concurrency and parallelism.

Concurrency happens when there are to tasks running and one is waiting for the other to keep going.
Parallel tasks, otherwise, run at the same time, independently, and are only admitted in processors that
have two or more cores (dual, quad, etc.). A thread is the smaller processing unit. This depends on the
computer architecture. Deadlock happens in the context of an interdependent process when a process is
locked. The smaller instruction is an assembly function. A socket is a bidimensional channel of
communication.

33. Dev Ops

Set of principles to automate and integrate software development, testing and distribution. Cherish speed,
security and scalability. Modern tools: AWS, Azure and Google Cloud.

CI (Continuous Integration): testing and process integration.


CD (Continuous Delivery): continuous system releases.
Microservices: teams responsible for small parts of the code.
Infrastructure as a code: containerization.
Logging

34. Hardware Basics


Processor: the computer’s brain, where all the math is done.

ROM (read-only memory): permanent content put by the hardware maker and accessed only as reading.

RAM (random access memory): memory used by processor to alocate memory in runtime. Stands the OS.

HD (Hard Disk) and SSD: persistent memory.

35. Math Basics and Logic Basics

Fibonacci sequence:

f1 = 0
f2 = 1
f3 = 1
f4 = 2
f5 = 3
f6 = 5
f7 = 8
f8 = 13
f9 = 21
f10 = 34

// Print all Fibonacci numbers up to 100.


using System.Numerics;

const int Last = 100;


const int Start = 2;
var sequence = new Dictionary<BigInteger, BigInteger>() { { 1, 0 }, { 2, 1 } }.ToList();

for (int i = 0; i < Last; i++)


{
if (i >= Start)
sequence.Add(new KeyValuePair<BigInteger, BigInteger>(i + 1, sequence[i - 1].Value + sequence[i
- 2].Value));

Console.WriteLine($"F{sequence[i].Key} = {sequence[i].Value}");
}

// Print all prime numbers up to 100.

const int Limit = 100;

for (int i = 1; i <= Limit; i++)


{
var divisors = new List<int>();

for (int j = 1; j <= i; j++)


{
if (i % j == 0)
divisors.Add(j);
}

if (divisors.Count == 2)
Console.WriteLine(i);
}

S→P

If S = T, so P = T (Modus ponens).
If S = F, so P = T or F.
If P = F, so S = F (Modus tolens).
If P = T, so S = T or F.

You might also like