Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
HaB
Jan 5, 2001

What are the odds?

ModeSix posted:

To be fair this is the front-end thread so he's likely never touched the backend beyond express (which honestly should be the absolute last choice for a backend if you ask me) or some other JS flavour of the week. Because anyone that says that hasn't really done backend work.

When the backend "just works" it appears really simple to the consumer.

Plus you have several choices across the entire stack as to where you stick the complexity. I have done apps which relied on a lot of complicated stored procedures to return data, so the Express service was SUPER simple. Pretty sure my longest route handler was maybe 10 lines.

Then I've written ones where the node piece is doing the bulk of the work (in this case Hapi).

Both of those look equal as far as the front-end is concerned, since they both just return JSON in a format the front-end understands.

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

How complicated your frontend or your backend is going to be is almost entirely contingent on the nature of your app.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

ModeSix posted:

To be fair this is the front-end thread so he's likely never touched the backend beyond express (which honestly should be the absolute last choice for a backend if you ask me) or some other JS flavour of the week. Because anyone that says that hasn't really done backend work.

When the backend "just works" it appears really simple to the consumer.

When I make that statement I am ignoring devops, which thanks to lots of really smart people isn't as complicated as it used to be. Load balancing and sharding and stuff like that is still pretty complicated.

I'm talking about just the code. There are so many complex well tested frameworks/modules/etc out there it's all relatively straight forward, I mean, largely... if you need to process data from a satellite or something like that then to me we're talking about something else. You'd likely abstract that into a separate microservice or at least a module.

Then you just piece it together. It's all encapsulated in a reliable environment. It's like lego at that point.

Client side development on the other hand is the drat wild west.

Doh004
Apr 22, 2007

Mmmmm Donuts...

Nolgthorn posted:

When I make that statement I am ignoring devops, which thanks to lots of really smart people isn't as complicated as it used to be. Load balancing and sharding and stuff like that is still pretty complicated.

I'm talking about just the code. There are so many complex well tested frameworks/modules/etc out there it's all relatively straight forward, I mean, largely... if you need to process data from a satellite or something like that then to me we're talking about something else. You'd likely abstract that into a separate microservice or at least a module.

Then you just piece it together. It's all encapsulated in a reliable environment. It's like lego at that point.

Client side development on the other hand is the drat wild west.

Yep, just keep digging that hole bud.

ModeSix
Mar 14, 2009

Nolgthorn posted:

When I make that statement I am ignoring devops, which thanks to lots of really smart people isn't as complicated as it used to be. Load balancing and sharding and stuff like that is still pretty complicated.

I'm talking about just the code. There are so many complex well tested frameworks/modules/etc out there it's all relatively straight forward, I mean, largely... if you need to process data from a satellite or something like that then to me we're talking about something else. You'd likely abstract that into a separate microservice or at least a module.

Then you just piece it together. It's all encapsulated in a reliable environment. It's like lego at that point.

Client side development on the other hand is the drat wild west.

Sure some of the technologies are mature, but that doesn't mean they're easy. Go build a .NET backend and then tell me how easy it is. :)

Just because the data comes out of the API looking simple does not mean there isn't a lot of actual code behind it making it look nice. Even a properly built Express server is a complicated jungle of code, because a lot of data gets reformatted, processed, chewed, spit out, reprocessed again and a lot of other things happen before it's presented to the consumer.

If you're talking about a simple RESTful server, sure that's easy, but even there you also have to consider how to get the data from the datasource and formatting for consumption.

On my projects I do both front-end and back-end work. I'm no professional, but there's really not anything simple about either.

tldr; backend isn't simple, straightforward or easy, even with tried and tested frameworks.

ModeSix fucked around with this message at 17:24 on Oct 5, 2017

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

If all you're doing is a simple CRUD server than the backend is easy...but than again so is the frontend in that case.

If your backend is doing a lot of ... stuff ... then it can be complicated, but that has little bearing on whether the frontend is complicated or not.

If your frontend is complicated that has no bearing on whether the backend is complicated or not.

There are lots of mature frontend frameworks that you can build with like legos just like on the backend.

The framework and library situation on the frontend only makes the frontend more complicated than the backend if you're chasing the bleeding edge.

Of course, the same also holds true for the backend.

TLDR: Backend and frontend can both be complicated or simple and calling out either for being easy or hard is simplistic.

ModeSix
Mar 14, 2009

Thermopyle posted:

If all you're doing is a simple CRUD server than the backend is easy...but than again so is the frontend in that case.

If your backend is doing a lot of ... stuff ... then it can be complicated, but that has little bearing on whether the frontend is complicated or not.

If your frontend is complicated that has no bearing on whether the backend is complicated or not.

There are lots of mature frontend frameworks that you can build with like legos just like on the backend.

The framework and library situation on the frontend only makes the frontend more complicated than the backend if you're chasing the bleeding edge.

Of course, the same also holds true for the backend.

TLDR: Backend and frontend can both be complicated or simple and calling out either for being easy or hard is simplistic.

Agreed. I think that's what I was trying to say, but you put it much more succinctly.

luchadornado
Oct 7, 2004

A boombox is not a toy!

prom candy posted:

I asked about using type safe languages on the server a couple days ago and was directed towards C#, which looks interesting. Is anyone just using Typescript with Express or another Node framework to build their APIs and auth endpoints and stuff?

I've used Typescript with Express, Koa, Hapi, and a web framework that we built in house and would still strongly recommended it for the backend. Unless it was a POC or something super small, I would never want to work without Typescript on a JS project.

Nolgthorn posted:

Server code is also in my experience not all that complex, compared to a client side app so value is reduced.

Client side app complexity is highly based on the things complained about in this thread - the lack of a cohesive framework on the React side of things (CRA doesn't count), and the myriad of ways to create tons of boilerplate, designers being anal about things, etc. Whole different set of complexity for building APIs where good design and contracts are critical up front, scaling issues, infrastructure issues, etc. Things like routing in a framework like .NET MVC are dead simple, where it can get complicated with React apps.

prom candy
Dec 16, 2005

Only I may dance
https://twitter.com/mathowie/status/837735473745289218/photo/1

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.




And it's still not complicated enough because I can't turn off loving toast popups without giving up the taskbar-entry-flashing functionality.

megalodong
Mar 11, 2008

Nolgthorn posted:

Client side development on the other hand is the drat wild west.

Front end stuff is the "wild west" because it's full of poo poo built by idiots based off blog posts by other idiots based off 5 minutes with the previous framework of the week, not because of any inherent greater difficulty than server-side stuff.

prom candy
Dec 16, 2005

Only I may dance
It's the Wild West because we also have to keep up with UI/UX trends in order to be as user friendly AND unique as possible. I loving love it though.

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.

prom candy posted:

It's the Wild West because we also have to keep up with UI/UX trends in order to be as user friendly AND unique as possible. I loving love it though.

It not even trends per se. If you're building frontend, it isn't completely reducible to a logical input -> output, it is part aesthetic and you can't really remove that part without making poo poo, that's when you get the "clearly built by a backender" style interfaces. Some poor shmuck has to actually use the interface, rather than a computer. Smoothness, animation, timing of responses and indicators, a million and one other tiny things; they're pretty irrelevant to how a computer would deal with things, and they're hard to get right. Not harder than anything else, just different problems (maybe sometimes perceived as all just horrible untestable messy side effects?)

Doh004
Apr 22, 2007

Mmmmm Donuts...

prom candy posted:

It's the Wild West because we also have to keep up with UI/UX trends in order to be as user friendly AND unique as possible. I loving love it though.

Just keep in mind, there are plenty of other "front-end"s that need to keep up with UI/UX trends that aren't being rendered on browsers and whose tooling ecosystem isn't a complete dumpster fire!

(yes, I know this thread is front end web-dev).

prom candy
Dec 16, 2005

Only I may dance
Having to support browsers is probably a large part of the reason that the ecosystem is so difficult though. Remember when you needed javascript libraries for rounded corners and drop shadows? We're always a couple steps back. I spent two hours yesterday tweaking code to make a modal that, when opened on mobile safari, didn't allow the user to scroll the body and didn't jump the scroll position back to the top of the page. On every other browser it's just "overflow: hidden" on the body. On Mobile Safari it's capturing the current scroll position, setting the body's position to fixed and the top to that scroll position * -1, and then on closing the modal, re-scrolling the window back down to the stored scroll position. Things like that make codebases messier, code harder to reason about, and are a big part of the reason that lots of back-end people just don't want to deal with this poo poo.

luchadornado
Oct 7, 2004

A boombox is not a toy!

The DOM API is hot garbage - you needed jQuery just to standardize between the browsers, you need transpilation to use any current features that make dev easier while still supporting idiots using IE 10/11, and you need things like Angular and React just to deal with how incredibly inefficient it is the update the DOM.

It's made worse by Mozilla being altruistic, Google chasing web/ad domination, and Apple hoping the web dies in favor of walled garden apps for consuming content.

If people didn't flip their poo poo about Microsoft in the 90s we might all be using a standardized browser with deep .NET integration and sane DRM solutions. We stopped Microsoft from taking over the world, but now we have Google, Apple, and Facebook doing the same poo poo they did. It's an interesting "what if" to consider.

Giga Gaia
May 2, 2006

360 kickflip to... Meteo?!

prom candy posted:

Having to support browsers is probably a large part of the reason that the ecosystem is so difficult though. Remember when you needed javascript libraries for rounded corners and drop shadows? We're always a couple steps back. I spent two hours yesterday tweaking code to make a modal that, when opened on mobile safari, didn't allow the user to scroll the body and didn't jump the scroll position back to the top of the page. On every other browser it's just "overflow: hidden" on the body. On Mobile Safari it's capturing the current scroll position, setting the body's position to fixed and the top to that scroll position * -1, and then on closing the modal, re-scrolling the window back down to the stored scroll position. Things like that make codebases messier, code harder to reason about, and are a big part of the reason that lots of back-end people just don't want to deal with this poo poo.

Mobile Safari is the Hitler of web browsers.

prom candy
Dec 16, 2005

Only I may dance
Only if Hitler had been more successful in his world takeover

Honest Thief
Jan 11, 2009
Safari is supposed to be WebKit same as chrome so how the gently caress you get specific flickering issues on it and not on any other browser

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Honest Thief posted:

Safari is supposed to be WebKit same as chrome so how the gently caress you get specific flickering issues on it and not on any other browser

Nah they forked Chrome to Blink a good while ago now.

And Mobile Safari, while a pain in the rear end to dev for, is far more concerned with an optimised mobile experience than Mobile Chrome is on Android.

It doesn't make it any nicer to work on, but it is what it is. No one is really invested in web as a first class citizen, so it isn't, even though literally every web presence is supported by at least one website, it's never all apps all the time.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Helicity posted:

The DOM API is hot garbage - you needed jQuery just to standardize between the browsers, you need transpilation to use any current features that make dev easier while still supporting idiots using IE 10/11, and you need things like Angular and React just to deal with how incredibly inefficient it is the update the DOM.

It's made worse by Mozilla being altruistic, Google chasing web/ad domination, and Apple hoping the web dies in favor of walled garden apps for consuming content.

If people didn't flip their poo poo about Microsoft in the 90s we might all be using a standardized browser with deep .NET integration and sane DRM solutions. We stopped Microsoft from taking over the world, but now we have Google, Apple, and Facebook doing the same poo poo they did. It's an interesting "what if" to consider.

jQuery is an example of some of the litter on the floor of any website shop.

You did need it, a really long time ago, and people are still using it. Combining it even, with React Redux and every other monolithic piece of technology under the sun. So you end up with websites using MBs of javascript that runs slow and is a nightmare to maintain.

Updating the dom isn't inefficient it's super. If you update a whole bunch of things the browser is smart enough to optimise, to a fault. Where you have to build in hacks so that your ui details aren't optimised out of the rendering queue.

React/Redux isn't really smooth. Every update to the store runs every single mapStateToProps in the entire application. So then you end up caching selectors, not helpful for performance.

Spent a bunch of money on .Net courses and as soon as I was done never touched any of those things again. Everything in .Net land was closed source, you had to either pay for things as simple as a dropdown with timezones in it, or you had to build the component yourself which wasn't really easy. It was licensing out the butt.

I like client side coding but something has to be done about every developer in the world having a completely different vantage on it.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

To be pedantic, the DOM isn't slow...it's layout that is slow.

Adding/removing nodes is just a few pointer swaps. However, when you modify the DOM tree in any way via JS, when JS passes control back to the browser, the layout is recalculated. Layout is also recalculated when you access certain properties like offsetWidth/offsetHeight.

How React can* make things faster than some other options is by not touching DOM or triggering a layout operation more than one time when you update state.



* It's actually not uncommon for React to be slower than jQuery or vanilla JS...particulary for initial rendering time. Of course, Being Fast is not the most compelling reason to use React.

Thermopyle fucked around with this message at 22:04 on Oct 6, 2017

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Nolgthorn posted:

jQuery is an example of some of the litter on the floor of any website shop.

Not quite. While I try to avoid JQuery, for most small client sites it's preferable, because the minimal JQuery implementations like cash and others still miss 'something' that's incompatible with some obscure browser.

Those obscure browsers still exist, and people still use them. The proliferation of cheap smartphones mean that there are plenty of people who don't even realise they're browsing with a Samsung browser, not a stock Android.

Web developers often have a blinkered view of the full compatibility picture whilst devving almost exclusively on Chrome + Mobile Safari, but the reality is much more complex.

JQuery still has its place because it's one of the few libraries that has aimed for near ubiquitous compatibility in the face of this hosed up ecosystem.

While you can go 'not supported' and move on, this is often an unacceptable response for a smaller client who cares about every user. Sometimes it pays to just keep close to the baseline of all you need is a server render plus some aesthetic/light interactivity JavaScript.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

It would be neat if jquery was as modular as lodash where you can just pull in the specific functions you use in your code (maybe this exists, I've never looked in to it).

Though, there might not be much saving depending on how much common code there is between all the things jquery does...

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

ynohtna posted:

I know it's the awkward, ignored outsider kid on the JS playground but SystemJS sounds like an option for this situation in that all of its module importing, transpilation, bundling, hot loading, etc behaviours are available dynamically in the browser on top of the command line (via jspm).

I prototyped a similar system to yours last year using SystemJS except I had es-lisp source (:gay:) bundled off my drive as well as dynamically edited & hot-reloaded in the browser.

Of course, adopting a new packager (I felt that the SystemJS docs lacked a clear conceptual overview) and converting from create-react-app to jspm carries with it a considerable cognitive burden.

I ended up throwing a separate tsconfig file in my Turtle development folder and 'manually' kicking off that build inside of VSCode whenever I was working on the file. My index.html is fetching the built d.ts file with an XMLHttpRequest and adding it to the editor. Not a very graceful solution, but it's working for the moment.

prom candy
Dec 16, 2005

Only I may dance
Do you guys run all your build/dev scripts and stuff inside VS Code? Should I be configuring launch.json? I still just run everything in the terminal.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

prom candy posted:

Do you guys run all your build/dev scripts and stuff inside VS Code? Should I be configuring launch.json? I still just run everything in the terminal.

I run mine in command windows or the integrated command window in VS Code.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I don't use VS Code nowadays, but whatever editor or IDE I'm using I pretty much always run a terminal in separate windows running my build scripts, webpack server, etc.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I like to have a bunch of iTerm instances running on another screen. I never use the console in VS Code. Although, I'd love to be able to run a specific test or test file from the editor that would be nice.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

prom candy posted:

Do you guys run all your build/dev scripts and stuff inside VS Code? Should I be configuring launch.json? I still just run everything in the terminal.

Unless I'm mistaken, you need to have a launch.json configured in order to do in-editor debugging, setting break points, etc. I've found debugging in the editor to be pretty luxurious compared to the browser, and it does a lot to bridge the 'developer ergonomics' gap that exists between web dev and normal dev.

I do use an external shell to run the watch build scripts though, and use the VSCode shell to do, eg, npm installs, or git commands that are beyond the VSCode git interface.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Nolgthorn posted:

Although, I'd love to be able to run a specific test or test file from the editor that would be nice.

PyCharm/WebStorm.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I am building a Vue/Vuex app and have reached the stage where I need; clicking on some things trigger popovers that have all kinds of different stuff in them.

For example, clicking the trash can on a row of a list of items should trigger a popover with "Are you sure blah blah blah deleted and and xyz other related stuff?" with Delete and Cancel buttons. Some other popovers would have more complicated content.

How can I set something like that up, so that preferably near the App route I can render it?

code:
<div id="app">
    <page-header />
    <router-view />
    <page-footer />
</div>
Under the `page-footer` mayhaps.

I'm thinking I would put it into the store such as...

code:
{
    popover: {
        type: undefined,
        data: {}
    }
}
That way I could render a different component depending on the `type`, which I would treat as an enum. And I'd have any extra data I needed by replacing the `data` object. Does that sound about right for how I should approach this challenge? Is there an established best practice for this type of thing.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Nolgthorn posted:

I am building a Vue/Vuex app and have reached the stage where I need; clicking on some things trigger popovers that have all kinds of different stuff in them.

For example, clicking the trash can on a row of a list of items should trigger a popover with "Are you sure blah blah blah deleted and and xyz other related stuff?" with Delete and Cancel buttons. Some other popovers would have more complicated content.

How can I set something like that up, so that preferably near the App route I can render it?

code:
<div id="app">
    <page-header />
    <router-view />
    <page-footer />
</div>
Under the `page-footer` mayhaps.

I'm thinking I would put it into the store such as...

code:
{
    popover: {
        type: undefined,
        data: {}
    }
}
That way I could render a different component depending on the `type`, which I would treat as an enum. And I'd have any extra data I needed by replacing the `data` object. Does that sound about right for how I should approach this challenge? Is there an established best practice for this type of thing.

While I am not familiar enough with Vue to speak to it specifically, but this is basically just having a global variable being used as function parameters, and is generally a bad thing to do.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
The documentation advises that I use the store if I want to do something in a parent or a sibling. I could render the popovers in the dom directly where the button is that opens them, I suppose and I can use position fixed.

But that doesn't feel right either.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Nolgthorn posted:

Spent a bunch of money on .Net courses and as soon as I was done never touched any of those things again. Everything in .Net land was closed source, you had to either pay for things as simple as a dropdown with timezones in it, or you had to build the component yourself which wasn't really easy. It was licensing out the butt.

I think what Helicity was getting at is imagining a world where we had (probably fewer) browsers that could run client side code written in a well-designed language like C#, not embedding WinForms into every browser. Might have gotten that if Microsoft had open sourced .Net 15 years ago to compete with Java more directly but oh well.

Anyway, those .net course will pay off if you ever write a non-trivial server ;)

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
C# is super useful because it's a good language in general.

I think my perception of C# in the browser was that it was essentially just another layer of abstraction on top of what everybody else was doing. It being closed source didn't help their case but it wasn't the biggest problem that I had.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Nolgthorn posted:

C# is super useful because it's a good language in general.

I think my perception of C# in the browser was that it was essentially just another layer of abstraction on top of what everybody else was doing. It being closed source didn't help their case but it wasn't the biggest problem that I had.

Sounds like you're talking about razor templates rather than actually executing C# in the browser VM.

If so, it's just server side rendering. Companies like Telerik make a money by saving you time. There's nothing preventing you from writing your own templates or writing a SPA and having your backend output JSON.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Best practice question about Vue js.

When I have a list of users, and I want to pass a bunch of props at once, is it better to pass a single prop as an object, a single prop as an id, all of the props using `v-bind`, or each prop I need individually.

code:
<user-item v-for="user of users" :key="user.id" v-bind="user" />

// or

<user-item v-for="user of users" :key="user.id" :user="user" />

// or

<user-item v-for="user of users" :key="user.id" :id="user.id" />

// or

<user-item v-for="user of users" :key="user.id"
  :id="user.id"
  :name="user.name"
  :email="user.email"
  :created-at="user.createdAt"
  ...ETCETC />
Lets say I need like 10 props in total...

If all I pass is the `id` then inside the `user-item` component I'd select each attribute I need from the store.

e:

Going with the `:user="user"` option, with `props: { user: { type: Object, required: true } }` and although I'm not sure about long term it is working for me well right now.

Nolgthorn fucked around with this message at 17:26 on Oct 10, 2017

Honest Thief
Jan 11, 2009

Blinkz0rz posted:

Sounds like you're talking about razor templates rather than actually executing C# in the browser VM.

If so, it's just server side rendering. Companies like Telerik make a money by saving you time. There's nothing preventing you from writing your own templates or writing a SPA and having your backend output JSON.
Has no bearing on the discussion, just an anecdote, I have some bad memories of working with some Telerik related product, I think it was Kendo, Kentico? But in general I never much liked working with CMS

Adbot
ADBOT LOVES YOU

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Honest Thief posted:

Has no bearing on the discussion, just an anecdote, I have some bad memories of working with some Telerik related product, I think it was Kendo, Kentico? But in general I never much liked working with CMS

My Telerik anecdote is from a few jobs ago when our .NET guy went to a Telerik training thing and was all excited about using their stuff and was loving life for a couple weeks then wanted to do something slightly different / display data in a way not provided for by the default setup, spent the next few weeks cursing Telerik, then the next few weeks after that re-doing everything to not use their stuff any more.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply