Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.idea/
*.iml
*.iws
*.eml
out/
.DS_Store
.svn
log/*.log
tmp/**
node_modules/
.sass-cache
css/reveal.min.css
js/reveal.min.js

# Prerequisites
*.d

# Builds, test, IDE
build/
.vscode/
googletest/

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Q&A sessions

<a href="https://coders.school">
<img width="500" data-src="coders_school_logo.png" src="coders_school_logo.png" alt="Coders School" class="plain">
</a>

## [Moduł 1](module1/)

### [Współpraca grupowa - Scrum](module1/scrum.md)

### [Konkurs STL](module1/konkurs.md)

### [Przykłady z Code Review](module1/code-review.md)

### [Pytania z kanału #powtórka](module1/repetition.md)
Binary file added coders_school_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
82 changes: 54 additions & 28 deletions session2/code-review.md → module1/code-review.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Powtórka #2
<!-- .slide: data-background="#111111" -->

## Przykłady z Code Review
# Przykłady z Code Review

---
___
<!-- .slide: style="font-size: 0.9em" -->

Example:

Expand All @@ -16,14 +17,17 @@ bool doesPasswordsMatch(const std::string& password, const std::string& repeated
```

Better:
<!-- .element: class="fragment fade-in" -->

```cpp
bool doesPasswordsMatch(const std::string& password, const std::string& repeatedPassword) {
return password == repeatedPassword;
}
```
<!-- .element: class="fragment fade-in" -->

---
___
<!-- .slide: style="font-size: 0.9em" -->

Example:

Expand Down Expand Up @@ -57,6 +61,8 @@ std::string getErrorMessage(ErrorCode Error) {
// We usually don't indent case and code inside namespace
```

___

Better?:

```cpp
Expand All @@ -78,7 +84,7 @@ std::string getErrorMessage(ErrorCode error) {
}
```

---
___

Example:

Expand All @@ -91,16 +97,17 @@ if(doesPasswordsMatch(first_pass, second_pass)) {
```

Better:
<!-- .element: class="fragment fade-in" -->

```cpp
if(doesPasswordsMatch(first_pass, second_pass)) {
return checkPasswordRules(first_pass);
}
return ErrorCode::PasswordsDoesNotMatch;
```
<!-- .element: class="fragment fade-in" -->


---
___

```cpp
enum class ErrorCode {
Expand All @@ -112,7 +119,8 @@ enum class ErrorCode {

> I do not know really, it's maybe my habit taken from python, to have commas also in the last element of enum/collection, because if I add new element in the future, i didn't have to worry about some errors in regards to missing comma :)

---
___
<!-- .slide: style="font-size: 0.75em" -->

> A: You can specify a size of vector in constructor :)

Expand All @@ -121,6 +129,7 @@ std::vector<std::shared_ptr<int>> resultVector(count);
```

> B: Yes, but what about situation, when count is negative value? I do not think such value should be used in the vector constructor, that's why I do such check first.
<!-- .element: class="fragment fade-in" -->

```cpp
std::vector<std::shared_ptr<int>> resultVector{};
Expand All @@ -129,18 +138,24 @@ if (count < 0) {
}
resultVector.reserve(count);
```
<!-- .element: class="fragment fade-in" -->

> A: you are right :) , my fault :)
<!-- .element: class="fragment fade-in" -->

> B: No problem, thanks for review :)
<!-- .element: class="fragment fade-in" -->

https://github.com/coders-school/kurs_cpp_podstawowy/pull/254/files
<!-- .element: class="fragment fade-in" -->

---
___
<!-- .slide: style="font-size: 0.85em" -->

Max długość linii - 120. Jak formatować?

Zazwyczaj linie są długie gdy funkcja przyjmuje wiele parametrów:
<!-- .element: class="fragment fade-in" -->

```cpp
int superFunction(std::vector<std::shared_ptr<int>> vectorOfSharedPointers, std::map<std::string, int> miniMap, std::unordered_set<int> hashes, std::function<void(int, int)> compareFunction) {
Expand All @@ -150,8 +165,10 @@ int superFunction(std::vector<std::shared_ptr<int>> vectorOfSharedPointers, std:
// usage
auto result = superFunction(mySuperVector, myMiniMap, myGreatHashTable, [](const auto & lhs, const auto & rhs) { return lhs >= rhs;})
```
<!-- .element: class="fragment fade-in" -->

Better formatting:
<!-- .element: class="fragment fade-in" -->

```cpp
int superFunction(std::vector<std::shared_ptr<int>> vectorOfSharedPointers,
Expand All @@ -167,6 +184,9 @@ auto result = superFunction(mySuperVector,
myGreatHashTable,
[](const auto & lhs, const auto & rhs) { return lhs >= rhs;});
```
<!-- .element: class="fragment fade-in" -->

___

Or for longer lambdas / too long first parameter which exceeds line limit:

Expand All @@ -176,7 +196,8 @@ int superFunction(
std::map<std::string, int> miniMap,
std::unordered_set<int> hashes,
std::function<void(int, int)> compareFunction) {
// two levels of indentation above to avoid confusion. The function body below will be indented with one level
// two levels of indentation above to avoid confusion.
// The function body below will be indented with one level
// do sth
}

Expand All @@ -188,24 +209,29 @@ auto result = superFunction(mySuperVector,
return lhs >= rhs;
});
```

---

* [Nice usage of std::map instead of ifs' ladder](https://github.com/coders-school/kurs_cpp_podstawowy/pull/252/files)
* Zwracajcie uwagę na znaki końca linii na końcu dokumentu.
* `enum` lub `enum class` są pod spodem wartościami całkowitymi (jakiś rodzaj inta). Nie warto przekazywać ich przez const& w celu optymalizacji.
* Max 2 puste linie. Zazwyczaj wystarcza jedna. 2 puste linie nie mogą wystąpić wewnątrz żadnych bloków (zakresów), jak funkcje, klasy, enumy.
* Dobra praktyka - alokowanie pojemności wektora, gdy jest z góry znana.
* Kiedy stosujemy konwencje?
* Współpraca grupowa - obowiązkowo. Nie ma nic gorszego niż niejednolite formatowanie w projekcie. Narzucamy wam styl zmodyfikowany styl Chromium, aby nie było przepychanek. Możecie go egzekwować do woli, w szczególności w Internal Code Review (czyli wewnątrz grupy, zanim zgłosicie nam Pull Request do sprawdzenia)
* Praca indywidualna - można stosować własne upodobania, ważne żeby było jednolicie.
* Nie bądźcie "code style nazi" i nie wymuszajcie na innych osobach waszego stylu formatowania, jeśli komentujecie indywidualne PR. Oczywiście fajnie gdyby wszystko było tak samo wszędzie, ale tak naprawdę co firma/projekt to spotkacie się z innym formatowaniem. Warto przywyknąć, że nie zawsze wam pasuje to co sprawdzacie. Głównie odnosi się to do nowych linii i nawiasów {}.
* `#include` - ja (Łukasz) nie jestem zbyt nazistowski z komentowaniem wam że:
* jest nieposortowane
* nie ma nowej linii
* żeby to przenosić do cpp zamiast trzymać w hpp
* usunąć, bo nieużywane.
<!-- .element: class="fragment fade-in" -->

___

* <!-- .element: class="fragment fade-in" --> <a href="https://github.com/coders-school/kurs_cpp_podstawowy/pull/252/files">Nice usage of std::map instead of ifs' ladder</a>
* <!-- .element: class="fragment fade-in" --> Zwracajcie uwagę na znaki końca linii na końcu dokumentu.
* <!-- .element: class="fragment fade-in" --> <code>enum</code> lub <code>enum class</code> są pod spodem wartościami całkowitymi (jakiś rodzaj inta). Nie warto przekazywać ich przez const& w celu optymalizacji.
* <!-- .element: class="fragment fade-in" --> Max 2 puste linie. Zazwyczaj wystarcza jedna. 2 puste linie nie mogą wystąpić wewnątrz żadnych bloków (zakresów), jak funkcje, klasy, enumy.
* <!-- .element: class="fragment fade-in" --> Dobra praktyka - alokowanie pojemności wektora, gdy jest z góry znana.
* <!-- .element: class="fragment fade-in" --> Kiedy stosujemy konwencje?
* <!-- .element: class="fragment fade-in" --> Współpraca grupowa - obowiązkowo. Nie ma nic gorszego niż niejednolite formatowanie w projekcie. Narzucamy wam styl zmodyfikowany styl Chromium, aby nie było przepychanek. Możecie go egzekwować do woli, w szczególności w Internal Code Review (czyli wewnątrz grupy, zanim zgłosicie nam Pull Request do sprawdzenia)
* <!-- .element: class="fragment fade-in" --> Praca indywidualna - można stosować własne upodobania, ważne żeby było jednolicie.
* <!-- .element: class="fragment fade-in" --> Nie bądźcie "code style nazi" i nie wymuszajcie na innych osobach waszego stylu formatowania, jeśli komentujecie indywidualne PR. Oczywiście fajnie gdyby wszystko było tak samo wszędzie, ale tak naprawdę co firma/projekt to spotkacie się z innym formatowaniem. Warto przywyknąć, że nie zawsze wam pasuje to co sprawdzacie. Głównie odnosi się to do nowych linii i nawiasów {}.

___

* <!-- .element: class="fragment fade-in" --> <code>#include</code> - ja (Łukasz) nie jestem zbyt nazistowski z komentowaniem wam że:
* <!-- .element: class="fragment fade-in" --> jest nieposortowane
* <!-- .element: class="fragment fade-in" --> nie ma nowej linii
* <!-- .element: class="fragment fade-in" --> żeby to przenosić do cpp zamiast trzymać w hpp
* <!-- .element: class="fragment fade-in" --> usunąć, bo nieużywane.

Tylko jak mi się rzuci w oczy to daję taki komentarz. Ale wiedzcie, że to są dobre praktyki i warto je stosować.
<!-- .element: class="fragment fade-in" -->

* Też nie bądźcie nazistami i nie róbcie całego code review tylko po to, żeby komuś wytknąć nieposortowane headery lub brakujące {} w jednym miejscu. Podczas projektów grupowych takie rzeczy sobie nawytykacie wewnątrz grup i tak się najszybciej nauczycie :) Na zewnątrz do sprawdzenia ma wychodzić kod przejrzany przez pozostałe osoby z grupy. Nie ma zwalania winy, że to pisał X i on nie dopilnował. Cała grupa obrywa równo ;)
* <!-- .element: class="fragment fade-in" --> Też nie bądźcie nazistami i nie róbcie całego code review tylko po to, żeby komuś wytknąć nieposortowane headery lub brakujące {} w jednym miejscu. Podczas projektów grupowych takie rzeczy sobie nawytykacie wewnątrz grup i tak się najszybciej nauczycie :) Na zewnątrz do sprawdzenia ma wychodzić kod przejrzany przez pozostałe osoby z grupy. Nie ma zwalania winy, że to pisał X i on nie dopilnował. Cała grupa obrywa równo ;)
File renamed without changes.
File renamed without changes
114 changes: 114 additions & 0 deletions module1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<title>Q&A sessions - Coders School</title>

<meta name="description" content="Testing">
<meta name="author" content="Łukasz Ziobroń">

<link rel="stylesheet" href="../../css/reset.css">
<link rel="stylesheet" href="../../css/reveal.css">
<link rel="stylesheet" href="../../css/theme/coders.css" id="theme">

<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="../../lib/css/monokai.css">

<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? '../../css/print/pdf.css' : '../../css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<section data-background="#111111">

<h1>Q&A sessions</h1>

<a href="https://coders.school">
<img width="500" data-src="../coders_school_logo.png" alt="Coders School" class="plain">
</a>

<h3>Łukasz Ziobroń</h3>

</section>
<section data-markdown>
<textarea data-template>

## Agenda

1. <!-- .element: class="fragment fade-in" --> Scrum
2. <!-- .element: class="fragment fade-in" --> Konkurs
3. <!-- .element: class="fragment fade-in" --> Code review - przykłady
4. <!-- .element: class="fragment fade-in" --> Pytania z kanału #Powtórka

</textarea>
</section>
</section>
<!--
Note that Windows uses `\r\n` instead of `\n` as its linefeed character.
For a regex that supports all operating systems, use `\r?\n` instead of `\n`.
Usage:
Install dependencies
$ npm install
Serve the presentation and monitor source files for changes
$ npm start
Open http://localhost:8000 to view your presentation
You can change the port by using npm start -- --port=8001.
-->
<section data-markdown="scrum.md"
data-separator-vertical="^___"
data-separator-notes="^Note:">
</section>
<section data-markdown="konkurs.md"
data-separator-vertical="^___"
data-separator-notes="^Note:">
</section>
<section data-markdown="code-review.md"
data-separator-vertical="^___"
data-separator-notes="^Note:">
</section>
<section data-markdown="repetition.md"
data-separator-vertical="^___"
data-separator-notes="^Note:">
</section>
<section data-background="#111111">

<h1>Coders School</h1>
<img width="400" data-src="../logo.png" alt="Coders School" class="plain">

</section>
</div>
</div>

<script src="../../js/reveal.js"></script>

<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
width: 1200,
height: 750,
slideNumber: true,
hash: true,
pdfSeparateFragments: false,
dependencies: [
{ src: '../../plugin/externalcode/externalcode.js', condition: function() { return !!document.querySelector( '[data-code]' ); } },
{ src: '../../plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '../../plugin/markdown/marked.js' },
{ src: '../../plugin/markdown/markdown.js' },
{ src: '../../plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>
Loading