[C++ Korea] Effective Modern C++ Study item 24-26
Item 24: Distinguish universal references from rvalue references. +석정로
Item 25 : Use std::move on rvalue references,
std::forward on universal references. +서승덕
Item 26 : Avoid overloading on universal references. +윤석준
[C++ korea] Effective Modern C++ 신촌 Study Item20,21,23Seok-joon Yun
[C++ korea] Effective Modern C++ 신촌 Study Item20,21,23
Item 20, 21, 23
Item 20 : Use std::weak_ptr for std::shared_ptr-like pointers that can dangle. +정은식
Item 21 : Prefer std::make_unique and std::make_shared to direct use of new. +이동우
Item 23 : Understand std::move and std::forward. +제한재
[C++ Korea] Effective Modern C++ Study item14 16 +신촌Seok-joon Yun
[C++ Korea] Effective Modern C++ Study item14 16 +신촌
Item 14 : Declare functions noexcept if they won't emit exceptions. +윤석준
Item 15 : Use constexpr whenever possible. +이동우
Item 16 : Make const member functions thread safe. +제한재
[C++ korea] Effective Modern C++ 신촌 Study Item20,21,23Seok-joon Yun
[C++ korea] Effective Modern C++ 신촌 Study Item20,21,23
Item 20, 21, 23
Item 20 : Use std::weak_ptr for std::shared_ptr-like pointers that can dangle. +정은식
Item 21 : Prefer std::make_unique and std::make_shared to direct use of new. +이동우
Item 23 : Understand std::move and std::forward. +제한재
[C++ Korea] Effective Modern C++ Study item14 16 +신촌Seok-joon Yun
[C++ Korea] Effective Modern C++ Study item14 16 +신촌
Item 14 : Declare functions noexcept if they won't emit exceptions. +윤석준
Item 15 : Use constexpr whenever possible. +이동우
Item 16 : Make const member functions thread safe. +제한재
Writing concurrent code is becoming more and more important to leverage the parallelism of multicore architectures. The C++11 library introduced futures and promises as a first step towards task-based programming. However, the C++ support of concurrency is still very limited. Other languages, like C# and Python, provide some forms of resumable functions or coroutines and in C#, the async/await pattern enables to write functions that suspend their execution while waiting for a computation or I/O to complete.This talk will describe a proposal for the addition of resumable function and async/await in C++17. We will focus on the implementation of resumable function on Windows, and we'll play with a first prototype of their implementation in the Visual Studio 2015 Preview. Finally, we will see how resumable functions can also be used to implement (lazy) generators, similar to the one provided by "yield" statements in C#.
모던 C++의 시초인 C++11은 C++ 코드 전반에 많은 변화를 가져왔습니다. 그리고 최근 C++20의 표준위원회 회의가 마무리되었습니다. 내년에 C++20이 도입되면 C++11이 처음 도입되었을 때와 비슷한 규모, 또는 그 이상의 변화가 있을 것이라고 예상하고 있습니다. C++20에는 Concepts, Contract, Ranges, Coroutine, Module 등 굵직한 기능 외에도 많은 기능들이 추가될 예정입니다. 이번 세션에서는 C++20에 추가될 주요 기능들을 살펴보고자 합니다.
Kivy is open source Module or platform to develop cross platform application in python. it supports python 2 and python 3 both. It is fully implemented in Cython (python library to write c code)
Clean Pragmatic Architecture - Avoiding a MonolithVictor Rentea
Talk built based on several of my trainings: http://www.victorrentea.ro/#training
Covers: Clean/Onion/Hexagonal Architecture, Domain Entities, Value Objects, Repository, Extract When it Grows Principle, Dependency Inversion Principle, Clean Code and Design Patterns.
These are the backing slides of the talks given at JPoint 2017 and Devoxx PL 2017: https://www.youtube.com/embed/4-4ahz7zDiQ
Functional Patterns with Java8 @Bucharest Java User GroupVictor Rentea
The slides for the presentation I gave at Bucharest Java User Group. This session was the largest Romanian Java community meetup ever organized until now.
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
Slides of the Talk I gave at Devoxx Belgium 2019.
=== Abstract ===
Focusing on the creative work without being terrified of breaking the existing behavior can make software development very addictive! Good automated tests can buy you that!
However, if your tests are not maintainable they may end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. Writing good tests becomes the toughest challenge for any developer, no matter how battle-hardened: you need to balance risk with test maintenance costs, while looking out for test design smells that call for [risky] refactoring to drive your design towards a set of key principles (included:).
Principles that will end up shaping the way you craft the Production code itself. Because in the end, a good, clean design is more important than coverage%.
But testing gives you the best feedback to get there.
Grab a black coffee and join this snippet from Victor’s Pro Unit Testing #training, to learn about testing priorities, buggy tests, the shared @Before, Mocks vs Stubs and how to reduce them by "purifying" your logic, testing Legacy Code and refactoring @Spy-es out.
All of that in an entertaining, dynamic and memorable session.
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019Kenneth Ceyer
올바른 코드 작성을 고민하는 연구자들을 위하여 - 클린코드는 여러분의 코드를 복잡한 패턴으로 구현하여 시간을 잡아먹는, 겉만 화려한 장식이 아닙니다. 모델을 구현하고, 또 그것을 테스트 할 때 이것이 정말 올바른 코드인지 궁금하셨나요? 이 세션에서는 연구 모델을 작성할 때 발견할 수 있는, 빈번한 코드 악취(Code smell)들과, 그것들을 어떻게 없앨 수 있을지에 대해서 알아봅니다. 코드에 영혼을 불어넣고, 그 어떤 코드라도 부끄럽지 않게 구현할 수 있는 연구자들이 되어봅시다!
Writing concurrent code is becoming more and more important to leverage the parallelism of multicore architectures. The C++11 library introduced futures and promises as a first step towards task-based programming. However, the C++ support of concurrency is still very limited. Other languages, like C# and Python, provide some forms of resumable functions or coroutines and in C#, the async/await pattern enables to write functions that suspend their execution while waiting for a computation or I/O to complete.This talk will describe a proposal for the addition of resumable function and async/await in C++17. We will focus on the implementation of resumable function on Windows, and we'll play with a first prototype of their implementation in the Visual Studio 2015 Preview. Finally, we will see how resumable functions can also be used to implement (lazy) generators, similar to the one provided by "yield" statements in C#.
모던 C++의 시초인 C++11은 C++ 코드 전반에 많은 변화를 가져왔습니다. 그리고 최근 C++20의 표준위원회 회의가 마무리되었습니다. 내년에 C++20이 도입되면 C++11이 처음 도입되었을 때와 비슷한 규모, 또는 그 이상의 변화가 있을 것이라고 예상하고 있습니다. C++20에는 Concepts, Contract, Ranges, Coroutine, Module 등 굵직한 기능 외에도 많은 기능들이 추가될 예정입니다. 이번 세션에서는 C++20에 추가될 주요 기능들을 살펴보고자 합니다.
Kivy is open source Module or platform to develop cross platform application in python. it supports python 2 and python 3 both. It is fully implemented in Cython (python library to write c code)
Clean Pragmatic Architecture - Avoiding a MonolithVictor Rentea
Talk built based on several of my trainings: http://www.victorrentea.ro/#training
Covers: Clean/Onion/Hexagonal Architecture, Domain Entities, Value Objects, Repository, Extract When it Grows Principle, Dependency Inversion Principle, Clean Code and Design Patterns.
These are the backing slides of the talks given at JPoint 2017 and Devoxx PL 2017: https://www.youtube.com/embed/4-4ahz7zDiQ
Functional Patterns with Java8 @Bucharest Java User GroupVictor Rentea
The slides for the presentation I gave at Bucharest Java User Group. This session was the largest Romanian Java community meetup ever organized until now.
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
Slides of the Talk I gave at Devoxx Belgium 2019.
=== Abstract ===
Focusing on the creative work without being terrified of breaking the existing behavior can make software development very addictive! Good automated tests can buy you that!
However, if your tests are not maintainable they may end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. Writing good tests becomes the toughest challenge for any developer, no matter how battle-hardened: you need to balance risk with test maintenance costs, while looking out for test design smells that call for [risky] refactoring to drive your design towards a set of key principles (included:).
Principles that will end up shaping the way you craft the Production code itself. Because in the end, a good, clean design is more important than coverage%.
But testing gives you the best feedback to get there.
Grab a black coffee and join this snippet from Victor’s Pro Unit Testing #training, to learn about testing priorities, buggy tests, the shared @Before, Mocks vs Stubs and how to reduce them by "purifying" your logic, testing Legacy Code and refactoring @Spy-es out.
All of that in an entertaining, dynamic and memorable session.
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019Kenneth Ceyer
올바른 코드 작성을 고민하는 연구자들을 위하여 - 클린코드는 여러분의 코드를 복잡한 패턴으로 구현하여 시간을 잡아먹는, 겉만 화려한 장식이 아닙니다. 모델을 구현하고, 또 그것을 테스트 할 때 이것이 정말 올바른 코드인지 궁금하셨나요? 이 세션에서는 연구 모델을 작성할 때 발견할 수 있는, 빈번한 코드 악취(Code smell)들과, 그것들을 어떻게 없앨 수 있을지에 대해서 알아봅니다. 코드에 영혼을 불어넣고, 그 어떤 코드라도 부끄럽지 않게 구현할 수 있는 연구자들이 되어봅시다!
[C++ Korea 2nd Seminar] C++17 Key Features SummaryChris Ohk
C++은 10년 만에 C++11/14를 발표하면서 '모던 C++'이라는 이름으로 발전했습니다. 그만큼 새로운 기능들이 많이 추가되었습니다. 그리고 2017년, C++은 C++17이라는 이름으로 또 한 번의 발전을 준비하고 있습니다. 3년 주기로 빠르게 변화하는 모던 C++에 대비하기 위해, C++17에 추가될 주요 기능들을 살펴보고자 합니다.
C++은 10년 만에 C++11/14를 발표하면서 '모던 C++'이라는 이름으로 발전했습니다. 그만큼 새로운 기능들이 많이 추가되었습니다. 그리고 2017년, C++은 C++17이라는 이름으로 또 한 번의 발전을 준비하고 있습니다. 3년 주기로 빠르게 변화하는 모던 C++에 대비하기 위해, C++17에 추가될 주요 기능들을 살펴보고자 합니다.
이 발표는 이전에 발표했던 내용에서 일부 사례 추가 및 최신 내용으로 갱신한 버전입니다.
33. Effective Modern C++ Study
C++ Korea33
std::multiset<std::string> History; // Global Log History
void Log(const std::string& item)
{
History.emplace(item);
}
std::string name("Luna");
Log(name);
Log(std::string("Star"));
Log("Seokjoon");
// Parameter로 name이라는 변수가 사용됨.
// L-Value가 emplace로 COPY
// Parameter로 R-Value가 전달되었지만,
// item이 L-Value라서 결국 emplace로 COPY
// Parameter로 R-Value가 전달되었지만,
// 임시로 std::string 개체가 만들어져서 결국 emplace로 COPY
Universal Reference + std::forward 면 efficient하게 할 수 있다.
34. Effective Modern C++ Study
C++ Korea34
std::multiset<std::string> History; // Global Log History
template<typename T>
void Log(T&& item)
{
History.emplace(std::forward<T>(item));
}
std::string name("Luna");
Log(name);
Log(std::string("Star"));
Log("Seokjoon");
// L-Value std::string를 emplace로 COPY (기존과 동일)
// R-Value를 emplace로 MOVE
// std::string를 item에서 임시로 만드는 것이 아니라
// multiset 안에다가 직접 생성함
하지만 std::string가 아닌 Indirect로 값을 받아야 할 경우가 있다면 ???
35. Effective Modern C++ Study
C++ Korea35
std::string GetItemFromTable(int idx);
void Log(int idx)
{
History.emplace(GetItemFromTable( ));
}
Log(22);
short s = 22;
Log(s);
// Call int overload
// Compile Error :
// can’t convert argument
// ‘short’ to std::string ctor
Universal Reference Overload 함수는 C++에서 가장 탐욕스러운 함수이다. (닥치는 대로 호로록)
• Instantiation of template (자세한 설명 생략)
• Overload Resolution Rule (자세한 설명 생략)
(위 2가지에 대해서 모른다면 검색해서 알아 보도록… Right Now !!!)
• Parameter가 int인 경우 정확히 int Overload 함수를 실행하지만,
• short인 경우는 T&&을 이용하여 Instantiation이 가능하다.
• Overload Resolution Rule에 의해서 template 함수가 호출되며,
Compile Error를 발생시킨다.
해결방법은 ? Perfect Forwarding Constructor (라고는 하는데 이번 item에서는 해결이 안된다.)
36. Effective Modern C++ Study
C++ Korea36
class Item {
public:
template<typename T>
explicit Item(T&& data) // Perfect Forwarding ctor
: value(std::forward<T>(data)) {}
explicit Item(int idx) // int ctor
: value(GetItemFromTable(idx)) {}
private:
std::string value;
};
• 하지만, int를 제외한 나머지 타입 (std::size_t, short, long …)에 대해서는 Universal Reference Constructor가 호출
• 심지어 생성자에 다른 Item 개체를 넣어도 Universal Reference Constructor 생성자가 ???
아 왜 ?
37. Effective Modern C++ Study
C++ Korea37
Item ME("Luna");
auto CloneofME(ME);
Item(const Item& SRC); // Copy ctor (Compiler-generated)
Item(Item&& SRC); // Move ctor (Compiler-generated)
explicit Item(Item& ) // Instantiated from Perfect Forwarding template
: value(std::forward<Item&>(data)) {}
• Overload Resolution Rule에 따라 본다면, 뭐가 가장 parameter에 똑같이 매칭될까 ?
• 그럼 해결 방법은 ?
Compiler는 C++의 Rule을 반드시 지키도록 맹세하였다. (융통성 없는 놈하고는…)
const Item ME("Luna"); // Object is now const
auto CloneofME(ME);
38. Effective Modern C++ Study
C++ Korea38
class ItemEx : public Item {
public:
ItemEx(const ItemEx& item) // Copy ctor
: Item(item) {} // Calls base class forward ctor
ItemEx(ItemEx&& item) // Move ctor
: Item(std::move(item)) {} // Calls base class forward ctor
};
• Derived Class에서 Base Class로 Item이 아닌 ItemEx로 전달하기 때문이다.
39. Effective Modern C++ Study
C++ Korea39
• Universal Reference를 Overload하면 뭘 상상하든 그 이상으로
훨씬 더 자주 맨날맨날 허구언날 시도때도 없이
Universal Reference Overload가 호출된다.
• Perfect Forwarding Constructor도 마찬가지다. 아니 이놈은 더하다.
non-const L-Value와의 궁합이 COPY Constructor보다 더 잘 맞고,
Derived class의 COPY, MOVE Constructor의 호출도 가로채버린다.
• 그냥 Universal Reference Overload 와 Perfect Forwarding Constructor를 쓰지마라.