How JavaScript works: inside the V8 engine + 5 tips on how to write optimized code β‘οΈ
A JavaScript engine is a program or an interpreter which executes JavaScript code. π
A JavaScript engine can be implemented as a standard interpreter, or just-in-time compiler that compiles JavaScript to bytecode in some form. β
Why was the V8 Engine createdβ
The V8 Engine which is built by Google is open source and written in C++. β¨
This engine is used inside Google Chrome. Unlike the rest of the engines, however, V8 is also used for the popular Node.js runtime.π
V8 was first designed to increase the performance of JavaScript execution inside web browsers. π¨
In order to obtain speed, V8 translates JavaScript code into more efficient machine code instead of using an interpreter.π₯
It compiles JavaScript code into machine code at execution by implementing a JIT (Just-In-Time) compiler like a lot of modern JavaScript engines do such as SpiderMonkey or Rhino (Mozilla). π¦
The main difference here is that V8 doesnβt produce bytecode or any intermediate code. β
https://t.me/pgimg/160
[ Article ] : kutt.it/js-md2
γ°γ°γ°γ°γ°γ°
#JavaScript #Internals #V8
@ProgrammingTip
A JavaScript engine is a program or an interpreter which executes JavaScript code. π
A JavaScript engine can be implemented as a standard interpreter, or just-in-time compiler that compiles JavaScript to bytecode in some form. β
Why was the V8 Engine createdβ
The V8 Engine which is built by Google is open source and written in C++. β¨
This engine is used inside Google Chrome. Unlike the rest of the engines, however, V8 is also used for the popular Node.js runtime.π
V8 was first designed to increase the performance of JavaScript execution inside web browsers. π¨
In order to obtain speed, V8 translates JavaScript code into more efficient machine code instead of using an interpreter.π₯
It compiles JavaScript code into machine code at execution by implementing a JIT (Just-In-Time) compiler like a lot of modern JavaScript engines do such as SpiderMonkey or Rhino (Mozilla). π¦
The main difference here is that V8 doesnβt produce bytecode or any intermediate code. β
https://t.me/pgimg/160
[ Article ] : kutt.it/js-md2
γ°γ°γ°γ°γ°γ°
#JavaScript #Internals #V8
@ProgrammingTip
Telegram
Programming Tips Resources
BDDfy β¨
BDDfy is the simplest BDD framework to use, customize and extendβοΈ
A few quick facts about BDDfy :
β’ It can run with any testing framework. Actually you don't have to use a testing framework at all. You can just apply it on your POCO (test) classes. β
β’ It does not need a separate test runner. You can use your runner of choice. For example, you can write your BDDfy tests using NUnit and run them using NUnit console or GUI runner, Resharper or TD.Net and regardless of the runner, you will get the same result. π₯
β’ It can run standalone scenarios. In other words, although BDDfy supports stories, you do not necessarily have to have or make up a story to use it. This is useful for developers who work in non-Agile environments but would like to get some decent testing experience. π
β’ You can use underscored or pascal or camel cased method names for your steps. π
β’ You do not have to explain your scenarios or stories or steps in string, but you can if you need full control over what gets printed into console and HTML reports. π
β’ BDDfy is very extensible: the core barely has any logic in it and delegates all its responsibilities to the extensions all of which are configurable; e.g. if you don't like the reports it generates, you can write your custom reporter in a few lines of code. β‘οΈ
https://t.me/pgimg/161
[ Github ] : kutt.it/bddfy
γ°γ°γ°γ°γ°γ°
#BDD #Testing #DotNet #CSharp
@ProgrammingTip
BDDfy is the simplest BDD framework to use, customize and extendβοΈ
A few quick facts about BDDfy :
β’ It can run with any testing framework. Actually you don't have to use a testing framework at all. You can just apply it on your POCO (test) classes. β
β’ It does not need a separate test runner. You can use your runner of choice. For example, you can write your BDDfy tests using NUnit and run them using NUnit console or GUI runner, Resharper or TD.Net and regardless of the runner, you will get the same result. π₯
β’ It can run standalone scenarios. In other words, although BDDfy supports stories, you do not necessarily have to have or make up a story to use it. This is useful for developers who work in non-Agile environments but would like to get some decent testing experience. π
β’ You can use underscored or pascal or camel cased method names for your steps. π
β’ You do not have to explain your scenarios or stories or steps in string, but you can if you need full control over what gets printed into console and HTML reports. π
β’ BDDfy is very extensible: the core barely has any logic in it and delegates all its responsibilities to the extensions all of which are configurable; e.g. if you don't like the reports it generates, you can write your custom reporter in a few lines of code. β‘οΈ
https://t.me/pgimg/161
[ Github ] : kutt.it/bddfy
γ°γ°γ°γ°γ°γ°
#BDD #Testing #DotNet #CSharp
@ProgrammingTip
Telegram
Programming Tips Resources
Getters/Setters. Evil. Period. πΊ
There is an old debate, started in 2003 by Allen Holub in this Why getter and setter methods are evil famous article, about whether getters/setters is an anti-pattern and should be avoided or if it is something we inevitably need in object-oriented programming. πΈ
The gist of the following text is this β¨ : getters and setters is a terrible practice and those who use it can't be excused. β
Again, to avoid any misunderstanding, I'm not saying that get/set should be avoided when possible. No. I'm saying that you should never have them near your code. π«
https://t.me/pgimg/163
[ Article ] : kutt.it/gset
γ°γ°γ°γ°γ°γ°
#BestPractices
@ProgrammingTip
There is an old debate, started in 2003 by Allen Holub in this Why getter and setter methods are evil famous article, about whether getters/setters is an anti-pattern and should be avoided or if it is something we inevitably need in object-oriented programming. πΈ
The gist of the following text is this β¨ : getters and setters is a terrible practice and those who use it can't be excused. β
Again, to avoid any misunderstanding, I'm not saying that get/set should be avoided when possible. No. I'm saying that you should never have them near your code. π«
https://t.me/pgimg/163
[ Article ] : kutt.it/gset
γ°γ°γ°γ°γ°γ°
#BestPractices
@ProgrammingTip
DDD - The 5 Minutes Tour πΎ
During a conference in Paris, after the organizers asked me to fulfill a missing-speaker slot for a lightning talk (an hour before the presentation time), not only did I accept, but I decided that an introduction to DDD (Domain Driven Design) was a good choice. Yes, DDDβββthe discipline that was born in a 560-page book. π
Unfortunately, even if I had managed to get the attention of a room crowded with (PHP!) developers to talk about a topic that was dear to my heart, I donβt know if the presentation insisted enough on the two key aspects that are DDD. β
My goal with this article is to give it another try, with more time to prepare. π
https://t.me/pgimg/164
[ Article ] : kutt.it/ddd
γ°γ°γ°γ°γ°γ°
#DDD
@ProgrammingTip
During a conference in Paris, after the organizers asked me to fulfill a missing-speaker slot for a lightning talk (an hour before the presentation time), not only did I accept, but I decided that an introduction to DDD (Domain Driven Design) was a good choice. Yes, DDDβββthe discipline that was born in a 560-page book. π
Unfortunately, even if I had managed to get the attention of a room crowded with (PHP!) developers to talk about a topic that was dear to my heart, I donβt know if the presentation insisted enough on the two key aspects that are DDD. β
My goal with this article is to give it another try, with more time to prepare. π
https://t.me/pgimg/164
[ Article ] : kutt.it/ddd
γ°γ°γ°γ°γ°γ°
#DDD
@ProgrammingTip
Telegram
Programming Tips Resources
PWA vs INSTANT APPS π
Since many of you wanted to know more about the specifics on PWA and INSTANT APPS, here is a quick review on the two, we will look at the 3 basic componential parts. β¨
β’ Speed π¨
β’ Build complexity π§
β’ Branding γ½οΈ
First PWA, what is it and why does everyone talks about itβ
Google as usual is the one standing behind popularising this concept. π
While you will see a lot of bold words like: fast, reliable, engaging. β‘οΈ
Esseintially it is a web app built with typical tools like HTML, CSS, JS and that has a nice caveat around it that can utilise something like service workers that stay in between your web app and the server. π
This allows PWA to have something that normal web sites won't provide - ability to work offline. π
You can easily try telegram, instagram, facebook as web apps and pin them to your mobile home page. π
So in short, it will provide you the typical app's functionality and will work fine. β
Don't confuse it with responsiveness though.π π»ββοΈ
While it does inteconnect, your Bootstrapped web site will not be considered as PWA just because it adapts to your user's screen. It will simply be a responsive site.π€π»
There is only 1 problem with this :
Since it is not an app, it is hard to get to phone's functionality like Bluetooth, Flashlight etc. π€―
https://t.me/pgimg/165
[ Read More ] : kutt.it/pwa
γ°γ°γ°γ°γ°γ°
#PWA
@ProgrammingTip
Since many of you wanted to know more about the specifics on PWA and INSTANT APPS, here is a quick review on the two, we will look at the 3 basic componential parts. β¨
β’ Speed π¨
β’ Build complexity π§
β’ Branding γ½οΈ
First PWA, what is it and why does everyone talks about itβ
Google as usual is the one standing behind popularising this concept. π
While you will see a lot of bold words like: fast, reliable, engaging. β‘οΈ
Esseintially it is a web app built with typical tools like HTML, CSS, JS and that has a nice caveat around it that can utilise something like service workers that stay in between your web app and the server. π
This allows PWA to have something that normal web sites won't provide - ability to work offline. π
You can easily try telegram, instagram, facebook as web apps and pin them to your mobile home page. π
So in short, it will provide you the typical app's functionality and will work fine. β
Don't confuse it with responsiveness though.π π»ββοΈ
While it does inteconnect, your Bootstrapped web site will not be considered as PWA just because it adapts to your user's screen. It will simply be a responsive site.π€π»
There is only 1 problem with this :
Since it is not an app, it is hard to get to phone's functionality like Bluetooth, Flashlight etc. π€―
https://t.me/pgimg/165
[ Read More ] : kutt.it/pwa
γ°γ°γ°γ°γ°γ°
#PWA
@ProgrammingTip
Telegram
Programming Tips Resources
Using Random on the production may put you in a troubleβοΈ
What is a random numberβ
Well, even if you have never read any definition, you can still answer that question pretty easy. π€·π»ββοΈ
Itβs the unpredictable result of some action like throwing a dice. π²
We just canβt predict what the next number will be. β
In a real world, randomness is kind of natural thing, but it starts to be more complicated when it comes to machines. π»
WhyβSimply because of their deterministic characteristic which makes it really hard to generate random numbers (but itβs still possible). β
Thatβs why in most of the time we use the pseudorandom numbers β they look like a random but they are the result of some mathematical algorithms.β‘οΈ
Are they used in generator offered in C#β
Letβs find out. π€
https://t.me/pgimg/166
[ Article ] : kutt.it/rnd
γ°γ°γ°γ°γ°γ°
#CSharp #Random
@ProgrammingTip
What is a random numberβ
Well, even if you have never read any definition, you can still answer that question pretty easy. π€·π»ββοΈ
Itβs the unpredictable result of some action like throwing a dice. π²
We just canβt predict what the next number will be. β
In a real world, randomness is kind of natural thing, but it starts to be more complicated when it comes to machines. π»
WhyβSimply because of their deterministic characteristic which makes it really hard to generate random numbers (but itβs still possible). β
Thatβs why in most of the time we use the pseudorandom numbers β they look like a random but they are the result of some mathematical algorithms.β‘οΈ
Are they used in generator offered in C#β
Letβs find out. π€
https://t.me/pgimg/166
[ Article ] : kutt.it/rnd
γ°γ°γ°γ°γ°γ°
#CSharp #Random
@ProgrammingTip
Telegram
Programming Tips Resources
Bulma π
Bulma is a modern CSS framework based on Flexbox. β¨
Bulma is a CSS framework. As such, the sole output is a single CSS file: bulma.css π
You can either use that file, "out of the box", or download the Sass source files to customize the variables. π
There is no JavaScript included. People generally want to use their own JS implementation. β‘οΈ
Bulma can be considered "environment agnostic": it's just the style layer on top of the logic. π
https://t.me/pgimg/167
[ Website ] : bulma.io
[ Github ] : kutt.it/blgit
γ°γ°γ°γ°γ°γ°
#CSS #Framework
@ProgrammingTip
Bulma is a modern CSS framework based on Flexbox. β¨
Bulma is a CSS framework. As such, the sole output is a single CSS file: bulma.css π
You can either use that file, "out of the box", or download the Sass source files to customize the variables. π
There is no JavaScript included. People generally want to use their own JS implementation. β‘οΈ
Bulma can be considered "environment agnostic": it's just the style layer on top of the logic. π
https://t.me/pgimg/167
[ Website ] : bulma.io
[ Github ] : kutt.it/blgit
γ°γ°γ°γ°γ°γ°
#CSS #Framework
@ProgrammingTip
Telegram
Programming Tips Resources
Framework Design Guidelines, 2nd Edition.pdf
45.3 MB
Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries - 2nd Edition π
Author π : Krzysztof Cwalina
γ°γ°γ°γ°γ°γ°
#Book #DotNet #BestPractices
@ProgrammingTip
Author π : Krzysztof Cwalina
γ°γ°γ°γ°γ°γ°
#Book #DotNet #BestPractices
@ProgrammingTip
Span π
C# gives us great flexibility when it comes to using different kinds of memory. π
But the majority of the developers use only the managed one. π€·π»ββοΈ
Use Span to work with ANY kind of memory in a safe and very efficient way. Simplify your APIs and use the full power of unmanaged memoryβοΈ
https://t.me/pgimg/170
[ Article ] : adamsitnik.com/Span
γ°γ°γ°γ°γ°γ°
#CSharp #DotNet
@ProgrammingTip
C# gives us great flexibility when it comes to using different kinds of memory. π
But the majority of the developers use only the managed one. π€·π»ββοΈ
Use Span to work with ANY kind of memory in a safe and very efficient way. Simplify your APIs and use the full power of unmanaged memoryβοΈ
https://t.me/pgimg/170
[ Article ] : adamsitnik.com/Span
γ°γ°γ°γ°γ°γ°
#CSharp #DotNet
@ProgrammingTip
Telegram
Programming Tips Resources
Branca as an Alternative to JWTβπ
Branca is a catchy name for IETF XChaCha20-Poly1305 AEAD message with an additional version number and timestamp.π
It is well suited to be used as an authenticated and encrypted API token. π₯
Branca specification does not specify the payload format. Among others you can use for example JWT payloads but still have modern encryption and smaller token size provided by Branca. β‘οΈ
Currently there are implemenations for JavaScript, Elixir, Go and PHP and a command line tool for creating and inspecting tokens. β¨
Heads upβοΈJWT itself is the payload part of a larger standard called Javascript Object Signing and Encryption (JOSE). That said the term JWT has become ubiquitous when actually referring JSON Web Signature (JWS) or JSON Web Encryption (JWE). π
Branca is based on Fernet specification. π
Fernet takes an user provided message, a secret key and the current time and generates an Authenticated Encrypted (AE) token. Authenticated encryption specifies a way to secure a message so that a 3rd party cannot fake it, alter it nor read it. π
https://t.me/pgimg/171
[ Read More ] : kutt.it/branca
γ°γ°γ°γ°γ°γ°
#Branca #Authentication #JWT
@ProgrammingTip
Branca is a catchy name for IETF XChaCha20-Poly1305 AEAD message with an additional version number and timestamp.π
It is well suited to be used as an authenticated and encrypted API token. π₯
Branca specification does not specify the payload format. Among others you can use for example JWT payloads but still have modern encryption and smaller token size provided by Branca. β‘οΈ
Currently there are implemenations for JavaScript, Elixir, Go and PHP and a command line tool for creating and inspecting tokens. β¨
Heads upβοΈJWT itself is the payload part of a larger standard called Javascript Object Signing and Encryption (JOSE). That said the term JWT has become ubiquitous when actually referring JSON Web Signature (JWS) or JSON Web Encryption (JWE). π
Branca is based on Fernet specification. π
Fernet takes an user provided message, a secret key and the current time and generates an Authenticated Encrypted (AE) token. Authenticated encryption specifies a way to secure a message so that a 3rd party cannot fake it, alter it nor read it. π
https://t.me/pgimg/171
[ Read More ] : kutt.it/branca
γ°γ°γ°γ°γ°γ°
#Branca #Authentication #JWT
@ProgrammingTip
Telegram
Programming Tips Resources
Saving Grandma's Recipes With Xamarin.Forms π΅π»
When creating mobile apps, you have to create and maintain the user interface and app logic for both iOS and Android separately π€ : Objective-C/Swift with XCode and Java with Android Studio. π€―
That can quickly turn into a pain. With Xamarin.Forms, however, the UI and app logic for your app resides in a single codebase and you get to use a single IDE to maintain it all β saving time and headaches. β
In this article, take a lap around Xamarin.Forms to see what it can do for you.π
My grandma makes the best, most fluffiest, go weak-in-your-knees buns that anybody has ever tasted.π
The problem is, thereβs a ton of secret ingredients (and Iβm not just talking love) that go into those buns, and those ingredients and directions are all stored in my grandmaβs head. π€¦π»ββοΈ
We all have family recipes like that, and instead of possibly forgetting them, in this article weβre going to create a mobile app for iOS and Android using Xamarin.Forms that will save them for myself and future generations of my family! π¨βπ©βπ§βπ¦
https://t.me/pgimg/172
[ Article ] : kutt.it/xam
γ°γ°γ°γ°γ°γ°
#Xamarin #Android #IOS
@ProgrammingTip
When creating mobile apps, you have to create and maintain the user interface and app logic for both iOS and Android separately π€ : Objective-C/Swift with XCode and Java with Android Studio. π€―
That can quickly turn into a pain. With Xamarin.Forms, however, the UI and app logic for your app resides in a single codebase and you get to use a single IDE to maintain it all β saving time and headaches. β
In this article, take a lap around Xamarin.Forms to see what it can do for you.π
My grandma makes the best, most fluffiest, go weak-in-your-knees buns that anybody has ever tasted.π
The problem is, thereβs a ton of secret ingredients (and Iβm not just talking love) that go into those buns, and those ingredients and directions are all stored in my grandmaβs head. π€¦π»ββοΈ
We all have family recipes like that, and instead of possibly forgetting them, in this article weβre going to create a mobile app for iOS and Android using Xamarin.Forms that will save them for myself and future generations of my family! π¨βπ©βπ§βπ¦
https://t.me/pgimg/172
[ Article ] : kutt.it/xam
γ°γ°γ°γ°γ°γ°
#Xamarin #Android #IOS
@ProgrammingTip
Telegram
Programming Tips Resources
What Happened When I Peeked Into My Node_Modules Directory π€―
The left-pad fiasco shook the JavaScript community to its core when a rouge developer removed a popular module from npm, causing tens of projects to go dark. β
While code bloat continues to slow down our websites, drain our batteries, and make βnpm installβ slow for a few seconds, many developers like myself have decided to carefully audit the dependencies we bring into our projects. π
Itβs time we as a community stand up and say enough is enough, this community belongs to all of us, not just a handful of JavaScript developers with great hair. π₯
I decided to document my experiences in auditing my projectsβ dependencies, and I hope you find the following information useful. β
https://t.me/pgimg/173
[ Article ] : kutt.it/nmo
γ°γ°γ°γ°γ°γ°
#JavaScript #NPM
@ProgrammingTip
The left-pad fiasco shook the JavaScript community to its core when a rouge developer removed a popular module from npm, causing tens of projects to go dark. β
While code bloat continues to slow down our websites, drain our batteries, and make βnpm installβ slow for a few seconds, many developers like myself have decided to carefully audit the dependencies we bring into our projects. π
Itβs time we as a community stand up and say enough is enough, this community belongs to all of us, not just a handful of JavaScript developers with great hair. π₯
I decided to document my experiences in auditing my projectsβ dependencies, and I hope you find the following information useful. β
https://t.me/pgimg/173
[ Article ] : kutt.it/nmo
γ°γ°γ°γ°γ°γ°
#JavaScript #NPM
@ProgrammingTip
Telegram
Programming Tips Resources
Programming Tips π‘
Photo
Object Thinking.pdf
3.7 MB
Object Thinking π
Author : David West π
Level : Advanced π
γ°γ°γ°γ°γ°γ°
#Book #DesignPatterns #OOP
@ProgrammingTip
Author : David West π
Level : Advanced π
γ°γ°γ°γ°γ°γ°
#Book #DesignPatterns #OOP
@ProgrammingTip
PrimeNG π
°οΈ
PrimeNG is a collection of rich UI components for Angular. π
All widgets are open source and free to use under MIT License. πΈ
Features π :
β’ 80+ Components
β’ Open Source
β’ Productivity
β’ Themes
β’ Templates
β’ Mobile
https://t.me/pgimg/174
[ Website ] : kutt.it/pmng
[ Github ] : kutt.it/pmngi
γ°γ°γ°γ°γ°γ°
#Angular #UIKit
@ProgrammingTip
PrimeNG is a collection of rich UI components for Angular. π
All widgets are open source and free to use under MIT License. πΈ
Features π :
β’ 80+ Components
β’ Open Source
β’ Productivity
β’ Themes
β’ Templates
β’ Mobile
https://t.me/pgimg/174
[ Website ] : kutt.it/pmng
[ Github ] : kutt.it/pmngi
γ°γ°γ°γ°γ°γ°
#Angular #UIKit
@ProgrammingTip
Telegram
Programming Tips Resources
Crontab Guru β±
Cron format is a simple, yet powerful and flexible way to define time and frequency of various actions. π
This is a quick and simple editor for Cron schedule expressions by Cronitor. β‘οΈ
https://t.me/pgimg/175
[ Website ] : crontab.guru
γ°γ°γ°γ°γ°γ°
#Cron #Timing
@ProgrammingTip
Cron format is a simple, yet powerful and flexible way to define time and frequency of various actions. π
This is a quick and simple editor for Cron schedule expressions by Cronitor. β‘οΈ
https://t.me/pgimg/175
[ Website ] : crontab.guru
γ°γ°γ°γ°γ°γ°
#Cron #Timing
@ProgrammingTip
Telegram
Programming Tips Resources
How DNS works β
A fun and colorful explanation of how DNS works.β¨
Hey thereβοΈThis comic explains what happens when you type a website address in your browser. π
https://t.me/pgimg/176
[ Website ] : howdns.works
γ°γ°γ°γ°γ°γ°
#DNS #Comic
@ProgrammingTip
A fun and colorful explanation of how DNS works.β¨
Hey thereβοΈThis comic explains what happens when you type a website address in your browser. π
https://t.me/pgimg/176
[ Website ] : howdns.works
γ°γ°γ°γ°γ°γ°
#DNS #Comic
@ProgrammingTip
Telegram
Programming Tips Resources
Framevuerk β¨
Fast, Responsive, Without Dependencies, Both Direction Support and Configurable UI Framework based on Vue.js. π
Features β‘οΈ :
β’ Configurable
β’ No Dependency
β’ Multi Direction
β’ Responsive
β’ SSR Ready
β’ Fast
https://t.me/pgimg/177
[ Website ] : framevuerk.com
[ Github ] : kutt.it/frvuerk
γ°γ°γ°γ°γ°γ°
#Vue #UI #Framework
@ProgrammingTip
Fast, Responsive, Without Dependencies, Both Direction Support and Configurable UI Framework based on Vue.js. π
Features β‘οΈ :
β’ Configurable
β’ No Dependency
β’ Multi Direction
β’ Responsive
β’ SSR Ready
β’ Fast
https://t.me/pgimg/177
[ Website ] : framevuerk.com
[ Github ] : kutt.it/frvuerk
γ°γ°γ°γ°γ°γ°
#Vue #UI #Framework
@ProgrammingTip
Telegram
Programming Tips Resources
Objects Should Be Immutable π€«
In object-oriented programming, an object is immutable if its state canβt be modified after it is created. π€π»
In Java/C#, a good example of an immutable object is String.β
Once created, we canβt modify its state. We can request that it creates new strings, but its own state will never change. β
However, there are not so many immutable classes in JDK. Take, for example, class Date. It is possible to modify its state using setTime(). π
This is an incomplete list of arguments in favor of immutability β‘οΈ:
β’ Immutable objects are simpler to construct, test, and use
β’ Truly immutable objects are always thread-safe
β’ They help to avoid temporal coupling
β’ Their usage is side-effect free (no defensive copies)
β’ Identity mutability problem is avoided
β’ They always have failure atomicity
β’ They are much easier to cache
β’ They prevent NULL references, which are bad
Letβs discuss the most important arguments one by one. π
https://t.me/pgimg/178
[ Article ] : kutt.it/immtb
γ°γ°γ°γ°γ°γ°
#BestPractices #DesignPatterns
@ProgrammingTip
In object-oriented programming, an object is immutable if its state canβt be modified after it is created. π€π»
In Java/C#, a good example of an immutable object is String.β
Once created, we canβt modify its state. We can request that it creates new strings, but its own state will never change. β
However, there are not so many immutable classes in JDK. Take, for example, class Date. It is possible to modify its state using setTime(). π
This is an incomplete list of arguments in favor of immutability β‘οΈ:
β’ Immutable objects are simpler to construct, test, and use
β’ Truly immutable objects are always thread-safe
β’ They help to avoid temporal coupling
β’ Their usage is side-effect free (no defensive copies)
β’ Identity mutability problem is avoided
β’ They always have failure atomicity
β’ They are much easier to cache
β’ They prevent NULL references, which are bad
Letβs discuss the most important arguments one by one. π
https://t.me/pgimg/178
[ Article ] : kutt.it/immtb
γ°γ°γ°γ°γ°γ°
#BestPractices #DesignPatterns
@ProgrammingTip
Telegram
Programming Tips Resources
Pose π₯
Replace any .NET method (including static and non-virtual) with a delegate. π
It is similar to Microsoft Fakes but unlike it Pose is implemented entirely in managed code (Reflection Emit API).β¨
Everything occurs at runtime and in-memory, no unmanaged Profiling APIs and no file system pollution with re-written assemblies.β‘οΈ
Example Usage π₯:
Shim static property getter β±:
[ Github ] : github.com/tonerdo/pose
γ°γ°γ°γ°γ°γ°
#CSharp #DotNet #Fake
@ProgrammingTip
Replace any .NET method (including static and non-virtual) with a delegate. π
It is similar to Microsoft Fakes but unlike it Pose is implemented entirely in managed code (Reflection Emit API).β¨
Everything occurs at runtime and in-memory, no unmanaged Profiling APIs and no file system pollution with re-written assemblies.β‘οΈ
Example Usage π₯:
Shim static property getter β±:
Shim dateTimeShim = Shim.Replace(() => DateTime.Now).With(() => new DateTime(2004, 4, 4));
Usage πΎ:// This block executes immediately
PoseContext.Isolate(() =>
{
// All code that executes within this block
// is isolated and shimmed methods are replaced
// Outputs "4/4/04 12:00:00 AM"
Console.WriteLine(DateTime.Now);
}, dateTimeShim);
https://t.me/pgimg/179[ Github ] : github.com/tonerdo/pose
γ°γ°γ°γ°γ°γ°
#CSharp #DotNet #Fake
@ProgrammingTip
Telegram
Programming Tips Resources
Clean Architecture with ASP.NET Core 2.1 π¦
The explosive growth of web frameworks and the demands of users have changed the approach to building web applications. π
Many challenges exist, and getting started can be a daunting prospect. Let's change that now. β
This talk provides practical guidance and recommendations. π
This video will cover architecture, technologies, tools, and frameworks. We will examine strategies for organizing your projects, folders and files. β‘οΈ
We will design a system that is simple to build and maintain - all the way from development to production. You leave this talk inspired and prepared to take your enterprise application development to the next level. π₯
https://t.me/pgimg/180
[ Video ] : kutt.it/cav
[ Source Code ] : kutt.it/cag
γ°γ°γ°γ°γ°γ°
#AspNet #Core #CleanCode
@ProgrammingTip
The explosive growth of web frameworks and the demands of users have changed the approach to building web applications. π
Many challenges exist, and getting started can be a daunting prospect. Let's change that now. β
This talk provides practical guidance and recommendations. π
This video will cover architecture, technologies, tools, and frameworks. We will examine strategies for organizing your projects, folders and files. β‘οΈ
We will design a system that is simple to build and maintain - all the way from development to production. You leave this talk inspired and prepared to take your enterprise application development to the next level. π₯
https://t.me/pgimg/180
[ Video ] : kutt.it/cav
[ Source Code ] : kutt.it/cag
γ°γ°γ°γ°γ°γ°
#AspNet #Core #CleanCode
@ProgrammingTip
Telegram
Programming Tips Resources