WebSharper веб-программирование без слёз Владимир Матвеев, IntelliFactory Антон Таяновский, IntelliFactory
Почему WebSharper? Когда пишешь JavaScript, хочется плакать: Нет вывода типов - опечатки приводят к ошибкам Нет толковой среды разработки Нет стандартной платформы, библиотек, коллекций Нет стандарта упаковки модулей и документации Copyright © IntelliFactory Kiev ALT.NET #6 | 2
Почему WebSharper? Еще хуже дело с клиент-серверными приложениями: Нужно думать о передаче данных и их упаковке Нужно привязывать скрипты, стили и HTML Copyright © IntelliFactory Kiev ALT.NET #6 | 3
Почему F#? Фунцкиональное программирование Вывод типов Удобная среда разработки Хорошая платформа Copyright © IntelliFactory Kiev ALT.NET #6 | 4
Комиляция F# в JavaScript Copyright © IntelliFactory Kiev ALT.NET #6 | 5 namespace Hello module Main = [ ] let rec Fac n = match n with | 0 -> 1 | n -> n * Fac (n - 1) > Hello.Main.Fac(10)
Стандартная библиотека Copyright © IntelliFactory Kiev ALT.NET #6 | 6 let d = Dictionary() for (k, v) in pairs do d.[k]
Удалённый вызов Copyright © IntelliFactory Kiev ALT.NET #6 | 7 [ ] let Save (user: User) = database.Save user async { return OK } [ ] let AddAccount() = let user =.. async { let! response = Save user do! Show response } |> Async.Start
Привязки JavaScript библиотек Copyright © IntelliFactory Kiev ALT.NET #6 | 8 let config = JQueryUI.DialogConfiguration( Draggable = true, Modal = true, Height = 370, Width = 500 Title = "..", CloseOnEscape = true) JQueryUI.Dialog.New(element, config)
Функциональный подход к UI Copyright © IntelliFactory Kiev ALT.NET #6 | 9 Formlet.Do { let! name = functionName let! text = functionText return name, text } |> Formlet.Flowlet
Функциональная маршрутизация Copyright © IntelliFactory Kiev ALT.NET #6 | 10 type Actions = | Main | DownloadWorksheet let Sitelet = Sitelet.Content "/" Main mainPage Sitelet.Infer (function | Main -> mainPage | DownloadWorksheet -> download ())
Статическая проверка ссылок Copyright © IntelliFactory Kiev ALT.NET #6 | 11 fun ctx -> A [Href (ctx.Link Main)] [Text "Home"]
Автоматизация зависимостей Copyright © IntelliFactory Kiev ALT.NET #6 | 12 module Styles = [ ] type Table() = inherit Resources.BaseResource("Styles.css") [ )] module UI =
To add a new slide, Click-M To modify your presentation title: – In the footer: Insert/Header&Footer, set Footer text in dialog box Click Apply to All to propagate to our slides – On the title/first slide: Do it manually Copyright © IntelliFactory Kiev ALT.NET #6 | 13
Presentation Interaction Core Logic Ajax in browserExtending browser capabilities Requires JavaScript, omnipresentSilverlight, Flash, applets, etc. Ajax JavaScript + XML Flash Flash on client Silverlight.NET on client Applets Java on client Client-based models (Silverlight, Flash, applets) Server-based models (ASP.NET, PHP, JSF, etc.)
Copyright © IntelliFactory Kiev ALT.NET #6 | 15
About IntelliFactory At IntelliFactory, we specialize in: o Building tools for functional, reactive web application development o Building robust.NET applications in F# o Migrating to and extending legacy.NET applications in F# o Customer-friendly, agile management of software development projects o F# trainings, from basic to advanced, from individual to enterprise-wide o Designing and implementing domain-specific languages
IntelliFactory – in a nutshell At IntelliFactory, we firmly believe in: o Expertise: constantly seeking to push the limits and apply FP o Diversity: we bring talents from all around the world o Solid academic and FP professional background o Bridging academia and industry - o Interns – EPFL, Caltech, EPITA, Eafit, ELTE o Sponsorship – Central European Summer School in FP o Industry partners – Microsoft, local and multi-national firms o A challenging place to work at – but with lots of creativity
Contact Us Today intellifactory.com Copyright © IntelliFactory Kiev ALT.NET #6 | 18 United States United Kingdom Hungary
Available at:
Latest Books on F# Copyright © IntelliFactory Kiev ALT.NET #6 | 20 More at