The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Adam Tolley (2) [Avatar] Offline
I feel that labeling ng directives as a DSL is confusing at best.

Firstly, HTML is already a domain specific, declarative language. Angular extends the syntax of this existing language in a predictable fashion, such that additional keywords are akin to names of functions in an API, not language extensions.

Secondly the argument that react does not leverage DSL, when JSX is exactly that, is very confusing.

Thirdly, React's approach to components seems very similar to tag-level ng directives at the markup level ( at least as of the first half of chapter 1 ) and making an argument of one versus another seems to muddy the waters considerably.

I would recommend steering clear of the claim, even if it feels justified, as it is a distraction to the subsequent point about not separating the structure and action of UI component into template and script.
Adam Tolley (2) [Avatar] Offline
NG Directives as a DSL - self rebuttal
On further reading and thinking, I guess I can see your point.

The built in ng-directives, and the filter syntax is, or might as well be, a DSL, as are templating languages.

And furthermore, JSX is a DSL, but a very thin one that amounts to syntactic sugar - again, at least as far as I have seen.

I am just a bit wary on introducing the concept of DSL vs not DSL out of the gate, as its a very overloaded term. The examples speak for themselves nicely though.

Perhaps I am being pedantic or over-literal, but this _is_ a book written for programmers. :/

Azat Mardan (41) [Avatar] Offline
I'm glad examples helped. I'm sure as you continue thru the book and continue to use React in your project, you'll see that JSX is just a shortcut and you can use JavaScript in it which simplifies things.

My main dislike of ng is that let's say I need to use ng-repeat... what is trackBy? How do I know this syntax? What is trackBy's function signature? Why colon and not equal sign? I need to know this from the docs or examples.

Not the exact syntax:
<div ng-repeat="let i = index; trackBy: (whatIsThis)=>{}" .../>


Azat, author of React Quickly