Write your own domain specific language with F# - Mikhail Smal

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ก.ค. 2024
  • F# is a powerful and expressive multi-paradigm language with high performance and focus on functional programming.
    This language allows you to write code, which a non technical person would be able to read and understand. In this talk I will show you how to write your own strongly and statically typed DSL. With it you will be able to focus on business logic and not get distracted with "keyword" noise.
    Check out more of our talks in the following links!
    NDC Conferences
    ndcoslo.com
    ndcconferences.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 15

  • @victornoagbodji
    @victornoagbodji 5 ปีที่แล้ว +9

    as a non dotnet developer i have find f# to be the most appealing language in the stack as far as syntax and features. but talks like these don't do enough justice to the language. most (i hope) have seen and heard about the syntax, discriminated unions, pattern matching, etc... it's very appealing.
    now how do i integrate it in my day to day job? can someone show something that they did in f# that is actively being used in their day to day job and not a hobby project? a business logic layer, a parsing layer, a data processing pipeline, did it fix tons of bugs, did it reduce processing time, reduce complexity? i mean anything... these will do more justice to the language. we all know by now it is a beautiful and feature rich language.

    • @mstu8097
      @mstu8097 4 ปีที่แล้ว +1

      @@seangwright Also Scott's own book:
      pragprog.com/book/swdddf/domain-modeling-made-functional
      Many examples in this talk seem to be straight out of this book, BTW.

  • @PatricHua
    @PatricHua 4 ปีที่แล้ว +10

    He just basically gave an overview of the F# language and didn't provide examples of DSL

    • @ilya6889
      @ilya6889 3 หลายเดือนก่อน

      No DSL here. Waste of time. Earned my dislike

  • @striker865
    @striker865 5 ปีที่แล้ว +1

    Thoughtful talk! Very interesting

  • @alexclark6777
    @alexclark6777 3 ปีที่แล้ว +2

    "I believe code written in this language that I've been working in for years is easily understandable to everyone, even non-programmers!". Unfortunately this isn't the case. It's easy to get blinded when you're close to a technology but it doesn't transfer to business people. What is "type" and why does everything say that? Is type a type declaration? Is it a function? Is it doing something, is it operating on something, is it declaring something? The moment this gets fuzzy for business people the first question out of their mouths is "why am I spending time trying to learn this?" F# is great and the it continues to evolve, but it's not a DSL for BAs. If a BA can't understand JSON then they're not going to understand this.

  • @weluvmusicz
    @weluvmusicz 5 ปีที่แล้ว

    And to create an api controller in F# it looks something like this:
    type HomeRendition() =
    [] val mutable Message : string
    [] val mutable Time : string
    type HomeController() =
    inherit ApiController()
    member this.Get() =
    this.Request.CreateResponse(
    HttpStatusCode.OK,
    HomeRendition(
    Message = "Hello from F#",
    Time = DateTimeOffset.Now.ToString("o")))
    Very readable, sure!

  • @donporter8432
    @donporter8432 5 ปีที่แล้ว

    Bravo! Presented well!

  • @FilipCordas
    @FilipCordas 5 ปีที่แล้ว +1

    Can some one tell me why no brackets is better then with brackets? If you show that syntax to a business person the will be just as confused as anybody else with that syntax. I looked at it and find it completely unreadable with too many names that are hard to keep a track of what they do.

    • @donporter8432
      @donporter8432 5 ปีที่แล้ว

      Point taken.

    • @seangwright
      @seangwright 5 ปีที่แล้ว +1

      I think the goal isn't so much for the business person to read the code (I don't think that's realistic), but by using the same terminology in code that the business person uses (domain language in DDD), you can communicate better with stakeholders on a project.
      The lack of brackets is related to the goal of F# to be terse and let a lot of the syntax fall away.
      It's something that takes getting used to if you come from a bracketed language - but there are many languages that don't use brackets and instead use whitespace (as F# does), like Python or VB.NET. There is less need for something like brackets in F# because brackets are often used with statements (think, if / else) whereas F# tries to focus on expressions (case/switch, ternary operator).
      I'm a C# / JavaScript / Typescript dev primarily but I enjoy switching to and writing F# as it helps me think differently about the applications I write.

    • @FilipCordas
      @FilipCordas 5 ปีที่แล้ว

      @@seangwright The type system in f# is really nice, similar to type script, but you do have a problem when there are too many types that you don't know how they act or what should be used for. I don't like it when people try to oversell something like in this case. I mean it's fine for a language to not use bracelets but you still need to start and end control blocks and it tends to be hard to do with only tabs and spaces because that too has it shortcomings it's not just an improvement on brackets.
      Second problem with this sort of languages is too much code in a single file I mean you could write minimized Javascript but that would not make your code better.

    • @seangwright
      @seangwright 5 ปีที่แล้ว +1

      @@FilipCordas In regards to the brackets thing, I wouldn't call the lack of brackets a pro or a con, it just is. Plenty of other languages don't have brackets (it's really a C heritage thing) and people are productive using them.
      Sometimes devs want less syntax, sometimes they want more. F# is on the 'less syntax' side of the spectrum.
      Also, there's nothing stopping you from putting functions and types into multiple modules (files) or other projects as libraries. The same "too much stuff in this file" problem is going to happen in any language.

  • @Seedzification
    @Seedzification 5 ปีที่แล้ว +8

    The title is completly misleading

  • @neontiger2007
    @neontiger2007 5 ปีที่แล้ว +1

    Looks pretty cool to invent measuring units and symbolics things right there in the language. But the guy needs to have a better English to communicate. Not everything tells you EXACTLY what it does without the minimal F# lecture (which I still didn't do, but I'm willing to, seems like a pretty neat lang). After 3/4 of the video I was almost sleeping because of not understanding yet those suffix-dense heavy-worded last examples.