Тёмный

Fast F#: Intro to Classes 

Fast F#
Подписаться 2,2 тыс.
Просмотров 854
50% 1

Classes are a first-class concept in F# even though we don't often need them. Here I'll show you how we define and work with them. I also advise when to stick to Records and Discriminated Unions and when to reach for Classes.
=== Contact ===
Email: hi@fastfsharp.com
Mastadon: mastodon.sdf.org/@fastfsharp
Twitter: / fastfsharp
=== Tags ===
Tags: #fsharp, #dotnet

Наука

Опубликовано:

 

20 фев 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 19   
@user-fs3qr5yg7e
@user-fs3qr5yg7e Месяц назад
i love your channel, both f# and it feel like a gem that i have discovered.
@odytrice
@odytrice 5 месяцев назад
Great Video, Love it.
@ricosaupe
@ricosaupe Год назад
Thanks. Again great explaining. :)
@michielnass4836
@michielnass4836 Год назад
Every video I learn something new and your intro 'Hello F#' always make me smile!
@FastFSharp
@FastFSharp Год назад
Glad to hear it!
@KurtMueller
@KurtMueller Год назад
"This" is how we do it.
@FastFSharp
@FastFSharp Год назад
🤣
@gajarubanjeyakumar7226
@gajarubanjeyakumar7226 Год назад
Thankyou!
@FastFSharp
@FastFSharp Год назад
You're welcome 😊
@gajarubanjeyakumar7226
@gajarubanjeyakumar7226 Год назад
@@FastFSharp looking forward to the next series. 💯
@KamillaMirabelle
@KamillaMirabelle Год назад
You can also us the 'as' to define the self identifier to globalize it uses type Chicken(name: string, size: float) as chick = ... This makes chick be the self identifier in any scope of the type declaration.. this mean that you can use member _ in memer naming. Minimizing typing it out and still make it concise
@FastFSharp
@FastFSharp Год назад
I was aware of that feature. That's nice to know. I rarely use self-identifiers but this is good to know!
@10199able
@10199able Год назад
When I was studying F# for the first time, these keywords were extremely confusing. On is "type" and other is "type", but in one case it's record, in another it's class. I wonder why they are not called with different names...
@FastFSharp
@FastFSharp Год назад
Well, Records are Classes under the hood. `type` just means you are expressing a type definition, it could be a Record, a DU, or a Class.
@thethreeheadedmonkey
@thethreeheadedmonkey Год назад
Will you at some point cover how to encapsulate validation into creation of records/classes?
@FastFSharp
@FastFSharp Год назад
Could you elaborate on what you are looking for? I did some validation on the input in this video.
@thethreeheadedmonkey
@thethreeheadedmonkey Год назад
​@@FastFSharp When I work with domain logic, I like to try and ensure that there's no way my instances of entities or value objects can be instantiated without proper validation. Using exceptions for validating this is one option (and sometimes the correct one, especially for things that are just obviously horribly wrong), but using a factory pattern and creating a Result or Option is my preferred approach. That way you can do partitioning and applicative validation, and also have nice, readable code, that doesn't need exception handlers for things that really aren't very exceptional. I think in F# this is perhaps not as straight forward to do (at least to me) as in less functionally inclined languages. I think it's possible by using modules, and only exposing create/tryCreate methods, but it can be a daunting thing to try when you're getting started.
@KamillaMirabelle
@KamillaMirabelle Год назад
Why do you type all types out? F# is type infered.. I understand you might need to restrict the name and size type in the construction, but the rest are not needed
@FastFSharp
@FastFSharp Год назад
Two reasons 1. To make it easier to follow for people watching the videos to know exactly what I am doing 2. I have found that I prefer the compiler messages that I get when I specify the types. When you rely on type inference, you can get wild compiler errors when refactoring. This is the style that I prefer, others are welcome to just rely on type inference 😊. This is one of the areas where my style diverges from the broader F# community.
Далее
Fast F#: Intro to Interfaces
22:01
Просмотров 766
Fast F#: Intro to Options
23:30
Просмотров 666
Нашли Краша Младшей Сестры !
23:46
Дарю Самокат Скейтеру !
00:42
Просмотров 1,5 млн
Rust Data Modelling Without Classes
11:25
Просмотров 165 тыс.
Welcome to Elm - 7.2 File Structure
27:10
Просмотров 229
Fast F#: Intro to Active Patterns
25:21
Просмотров 1,4 тыс.
Fast F#: Who Has Inspired You?
22:55
Просмотров 779
Fast F#: Anonymous Records
17:02
Просмотров 568
Deep Dive on LINQ with Stephen Toub
1:23:59
Просмотров 55 тыс.
Fast F#: Mapping Domain to Indexes
23:59
Просмотров 997
Choose a phone for your mom
0:20
Просмотров 6 млн