Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Five Lines Code:functional design pattern

 
Greenhorn
Posts: 27
Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Christian!!, do you use some examples of functional design in the book?.  what's your favorite characteristic in TS?
I think I could your book to learn type system with Kotlin ,

BR from PY.


 
Author
Posts: 31
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Enrique,

Thank you for your question.

I wasn't familiar with functional design, so my quick study of it may not be sufficient to answer your question. Although I agree with the single responsibility and low coupling these are quite abstract concepts, my book aims at providing rules that will yield the same benefits but without judgement. Single responsibility eg. arises from encapsulating things about specific data (ie. variables). It is probably something we could discuss at length, and I likely will do a conference talk about it at some point.

I cannot choose only one favorite characteristic in TS:
* Ease of adoption
* Union and intersections types
* Its type inference
 
Marshal
Posts: 74080
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How does TS (I presume that means TypeScript?) infer types? Is it strictly typed, like Java┬«? I have tried strictly‑typed languages, and Forth which is type‑free and can give all sorts of strange errors because it doesn't notice wrong types until runtime.
 
Christian Clausen
Author
Posts: 31
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
TypeScript is actually much more strongly typed than Java. In fact, I discuss this quite a bit in the forthcoming chapter 7.

I have worked with both very strongly typed languages like Coq, and untyped languages like Scheme. There are some fancy (mostly theoretical) tricks you can do in untyped languages which are not possible in typed languages, such as writing a decompiler in the language itself. However, in practice, if the community is good, and developers are disciplined it doesn't change much. Unfortunately, it seems a lot of especially young programmers lack a strict discipline, and then untyped code becomes a nightmare to maintain. This is my main concern with python, the culture for copying and pasting, with no regard for architecture or safety scares me. I think you need either discipline or types to build and maintain large systems.
 
Campbell Ritchie
Marshal
Posts: 74080
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. Last time I tried any compiler writing, my supervisor kept asking about things like READ, which allows direct input, but I was convinced that would violate the strict typing I had implemented. Also he had the notion that people would only use languages in a responsible fashion and I took a much more jaundiced view of users' likely actions
reply
    Bookmark Topic Watch Topic
  • New Topic