News for hackers. Stuff that matters.
Re:React created roadblocks in our enterprise app by bluefirebrand on Friday January 22, 2021 @02:14PM (#25875066)
100% this. The moment you allowed the .NET devs to bring their mindset into a fundamentally different space you were going in the wrong direction.
Re:React created roadblocks in our enterprise app by munchbunny on Friday January 22, 2021 @02:31PM (#25875297)
I've worked on stacks with .NET backends and React frontends, and there's a ton of truth to this. You can't use .NET concepts to bridge into an understanding of React. If you need to carry over .NET's paradigms, don't pick React.

Personally, I think if you want a deep understanding of React you need to first get in a few cycles of working with DOM, JS, CSS, etc. directly. Maybe throw in a functional programming language too. Then try to pick up React.

Re:React created roadblocks in our enterprise app by bluefirebrand on Friday January 22, 2021 @03:22PM (#25875916)
This really does nail it. Despite React having a somewhat OOP approach to a lot of things (and Class Components being the de facto for years), React best practices have evolved to be a very functional approach.

.NET wakes up every morning to have OOP pancakes OOP eggs and OOP coffee and it can't possibly allow even a hint of that beatnik functional style near it.

Re:React created roadblocks in our enterprise app by erlich on Friday January 22, 2021 @06:44PM (#25877828)
> evolved to be a very functional approach

Is this actually advantageous though over class components? The creator of React said he thought moving to functional components would make it harder for people to learn.

I've found that sometimes hooks can make things less flexible, more verbose, more error prone, and harder to reason about. Sometimes a class might have made things easier to understand.

I loved the fact that `useEffect` could modularize code that was otherwise split between `componentDidMount/Unmount/Update`...but couldn't a new class API also have solved this.

Maybe I just need to read the docs again to remind me. I'm all in for hooks, but it's rare that I think about what life could have been like if we kept class components.

Re:React created roadblocks in our enterprise app by filoeleven on Friday January 22, 2021 @08:21PM (#25878590)
The trouble that React has to deal with is that JavaScript lacks good built-in support for pure functions and immutable data. Hooks are an opinionated way to make React work more like FP, and there are still gotchas because of JS’s lack of enforcement.

“Advantageous” does not necessarily mean “easier to learn.” I’d say that for people coming from OOP, FP style is certainly unfamiliar and takes more getting used to. But for a front-end program that must always receive/send data to hand wave some other systems in order to do anything useful, it makes things much, much simpler. A whole class of problems disappears. The closer it gets to (state) => UI the easier it is to reason about and debug.

I still think that Reagent, the Clojurescript wrapper for React, is the best version of React available. All of the state management is handled by CLJS itself, and the language design prevents accidental mutation. You can still mutate things where appropriate, but it is always an intentional choice. A framework like re-frame takes this even further, with similar ideas as Redux but with better language support for and enforcement of the paradigm.

Re:React created roadblocks in our enterprise app by dmt0 on Saturday January 23, 2021 @01:20AM (#25880131)
> > evolved to be a very functional approach

> Is this actually advantageous though over class components? The creator of React said he thought moving to functional components would make it harder for people to learn.

At the end of the day you just end up thinking of the chunks of JSX and how they map to parts of the DOM, and who cares if those chunks of JSX are wrapped into a function or a class...

Re:React created roadblocks in our enterprise app by munchbunny on Friday January 22, 2021 @05:32PM (#25877134)
> .NET wakes up every morning to have OOP pancakes OOP eggs and OOP coffee and it can't possibly allow even a hint of that beatnik functional style near it.

I agree for the most part. More specifically you're not going to write functional code in C# and feel particularly good about what comes out. F# is a different story.

Speaking from experience a .NET (C#) backend and a React frontend is perfectly viable. The key is to keep the paradigms in their respective lanes, and if you're going to write code for both, get used to switching your mindset instead of converging the tools.

Re:React created roadblocks in our enterprise app by zmmmmm on Friday January 22, 2021 @03:21PM (#25875899)
I'm still kind of stuck on the fact that they brought a team of .NET devs on to do a React project. What did they think was doing to happen when they used a team with no experience in the technology stack chosen? The conversation should have started with "What skills do the implementation team have?" before tech was chosen.
Re:React created roadblocks in our enterprise app by bluefirebrand on Friday January 22, 2021 @03:24PM (#25875938)
Yes, or at the very least "Does the team have interest in learning this new tech or are they going to force their own notions onto it"
Re:React created roadblocks in our enterprise app by erlich on Friday January 22, 2021 @06:46PM (#25877845)
Is there a frontend framework you can choose that suits .NET devs? Maybe this would have been a better choice if there was. Maybe Angular was better. Or Ember.
Re:React created roadblocks in our enterprise app by 13rac1 on Friday January 22, 2021 @10:50PM (#25879444)
Yes, now, but not then https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor It's just .NET and C#
Re:React created roadblocks in our enterprise app by Spivak on Friday January 22, 2021 @02:31PM (#25875289)
I mean for a greenfield project sure but a port of an existing large application that is already coded in a specific style you likely want to preserve as much of that as possible to make the translation more mechanical.
Re:React created roadblocks in our enterprise app by majormajor on Friday January 22, 2021 @02:42PM (#25875412)
If you're porting between two languages/frameworks with radically different approaches, preserving the original project's approach in the new code is going to give you something that's probably worse than the original!

Now when you hire someone new you're going to be looking for React experience but then having to re-train them to think in .NET, or looking for .NET experience but training them to write React... and any time you have dependency upgrades, you're gonna be fighting more impedance mismatches.

Most tech debt that slows down feature development has more to do with the code structure than with the language or framework, so if you're intent on preserving the structure and style I don't know that you should be doing a rewrite at all!

Re:React created roadblocks in our enterprise app by cratermoon on Friday January 22, 2021 @03:04PM (#25875680)
As the old saying goes, you can write FORTRAN in any programming language: https://blog.codinghorror.com/you-can-write-fortran-in-any-l...
Re:React created roadblocks in our enterprise app by bluefirebrand on Friday January 22, 2021 @03:20PM (#25875881)
If you're aiming for code reuse don't rewrite. Refactor.
Re:React created roadblocks in our enterprise app by abhijitramesh on Friday January 22, 2021 @02:44PM (#25875438)
Totally agree with this