r/programming • • Oct 03 '16

How it feels to learn Javascript in 2016 [x-post from /r/javascript]

https://medium.com/@jjperezaguinaga/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f#.758uh588b
3.5k Upvotes

852 comments sorted by

View all comments

6

u/[deleted] Oct 03 '16

We need a port of .net common for the web and release a sane version of silver-light that doesn't need a plugin to run.

1

u/nickguletskii200 Oct 05 '16

I'm sorry, but I'd take React + Typescript + a 200 mb node_modules directory over WPF/Silverlight any day. WPF is like Angular but way worse.

1

u/[deleted] Oct 05 '16

Yeah, but you are still tied to HTML and CSS for doing layout, which sucks.

For applications, I would take XAML over html every time. That's what it's built for. It a layout engine for applications, not documents.

1

u/nickguletskii200 Oct 05 '16 edited Oct 05 '16

In my experience, layouts in XAML are a pain in the ass. I end up with so many RowDefinitions that it becomes quite hard to insert/move controls.

Also, WPF styling is shit. Being unable to compose styles is very annoying. I really wish I could style WPF applications with CSS.

And finally, not having to deal with the stupid bindings is amazing. I find myself in situations where I have to add additional code layers/hackish bindings to bind to the right information, and something that would've taken two lines with React takes hundreds of lines with WPF.

0

u/[deleted] Oct 05 '16

I end up with so many RowDefinitions that it becomes quite hard to insert/move controls.

Then use a stack panel.

Also, WPF styling is shit. Being unable to compose styles is very annoying. I really wish I could style WPF applications with CSS.

Uh, you can totally do this. You can either use blend expressions, or you can do it the hard way with styles in the resource dictionary. BTW, you can do a lot more with resource dictionaries than just styling.

http://stackoverflow.com/questions/120914/what-is-the-recomended-way-to-skin-an-entire-application-in-wpf

You can also use it for internationalization.

https://msdn.microsoft.com/en-us/library/bb613547(v=vs.110).aspx

And finally, not having to deal with the stupid bindings is amazing. I find myself in situations where I have to add additional code layers/hackish bindings to bind to the right information, and something that would've taken two lines with React takes hundreds of lines with WPF.

Like what? Just make sure your ViewModels implement INotifyPropertyChanged. You can chain stuff in the path too. Maybe you aren't making new user controls to help define your views and that's where some of your problems come in?

1

u/nickguletskii200 Oct 05 '16 edited Oct 05 '16

Do you think I don't know any of that shit?

Then use a stack panel.

I need a grid because I need both rows and columns. If I could use a StackPanel, I would.

Uh, you can totally do this. You can either use blend expressions, or you can do it the hard way with styles in the resource dictionary. BTW, you can do a lot more with resource dictionaries than just styling.

No you can not. WPF only provides style inheritance, and only one style can apply to a single component. You can create a crude markup extension that will cover combining styles in-place, but CSS is infinitely more powerful because of selectors, and it's much less verbose than the stupid XAML.

Like what? Just make sure your ViewModels implement INotifyPropertyChanged. You can chain stuff in the path too. Maybe you aren't making new user controls to help define your views and that's where some of your problems come in?

I use ReactiveUI, and most of my properties are reactive properties/OAPH backed. The problems start when you start binding the viewmodel to the the view, specifically in places like rows of DataGrids. You are forced to either leak the things that are supposed to take place in the view into the viewmodel, or write tons of view code. With React, I wouldn't have to do anything other than make sure the component gets rerendered once the data changes. Making something reusable is as simple as writing a lambda.

There's just no way you can convince me WPF is easier or faster to develop in. It is verbose, clunky and poorly documented (especially the parts concerning the DataGrid, grouping and filtering). React, on the other hand, is stupidly simple, easy to use and concise.

The only thing that makes WPF tolerable is ReactiveUI.

EDIT: Oh, and I forgot the worst part of WPF. It makes my blood boil. It doesn't respect CultureInfo! It uses the default locale for the language, completely ignoring any changes made through the system's culture settings and it doesn't allow programmers to override it!