/wdg/ - web dev general

/wdg/ - web dev general
Where is it? edition

Other urls found in this thread:

en.wikipedia.org/wiki/Representational_state_transfer
stackoverflow.com/questions/671118/what-exactly-is-restful-programming
coolafsitebruh.com/api/ping
benediktmeurer.de/2017/06/29/javascript-optimization-patterns-part2/
github.com/FreeCodeCamp/freecodecamp
twitter.com/NSFWRedditGif

Can somebody explain what restful actually means? I've read so much and it's just not clicking with me.

Read the original thesis, it is very undefendable.

It means your shuffling json data between clients and a server

You mean a transferrable interval or RTT (Round-Trip-Time) REST

RTT

But how is accessing site/people/person/mind/personality
Better than sending personality request for person directly to the backend and it handling the rest

programmers got tired after using soap all day, so they took a rest

Is there anything on the wiki you need clarification on specifically? Looking over it and it seems to cover mostly everything.

en.wikipedia.org/wiki/Representational_state_transfer

>By using a stateless protocol and standard operations, REST systems aim for fast performance, reliability, and the ability to grow, by re-using components that can be managed and updated without affecting the system as a whole, even while it is running.

>the user progresses through the application by selecting links, such as /user/tom, and operations such as GET or DELETE (state transitions), resulting in the next resource (representing the next state of the application) being transferred to the user for their use.

>REST is not a standard in itself, but RESTful implementations make use of standards, such as HTTP, URI, JSON, and XML. Many developers also describe their APIs as being RESTful, even though these APIs actually don't fulfill all of the architectural constraints described above (especially the uniform interface constraint)

>Web service APIs that adhere to the REST architectural constraints are called RESTful APIs

In practice it just means serving data via some serialization layer with a well-defined format. It's a rather nebulous term in reality.

In practice if someone refers to it they most likely just mean exposing a JSON api for inter-service data sharing.

Here's a decent explanation of the real world meaning, rather than the theoretical meaning originally proposed:
stackoverflow.com/questions/671118/what-exactly-is-restful-programming

All it means is that a server is hosting a resource at a certain url, and it accepts certain HTTP methods at that URL. It should always return the same data with the same inputs (which is what people mean when they say it is stateless)

eg my site coolafsitebruh.com/api/ping

returns a status 200 and a message "OK" when doing a GET http request no matter what.

Thanks

So if I want to find the amount of books written by authors starting with 'a' I would have to call /authors then wait for response then send 257 requests to each author asking for their books and waiting for each response?

If the api only allows those resources to be accessed.

But a better designed one would probably only require two requests:

One to the authors endpoint, and one to the books endpoint with a list of authors as an argument.

nigga where did you get my code from?

btw here's the updated version because more states

In a practical context what is the point of immutibility?

How is cloning then replacing an object better than just changing the relevant information? It has the same result but seems more convoluted and intensive

I'm not getting on very well with React and it's really annoying, everything I do and that I have learned is suddenly picked up and changed to now fit how react wants to work, but there's so little documentation and tutorials online that I am just left confused and angry all the time.

Everything I try to do has gone from simply "just do it" to "haha now go google how it works on react and then it doesn't work until you fuck around for 45 minutes lol"

It's like learning the basics all over again and feels incredibly inefficient for what I'm trying to do which is often not making much use of react anyway, but I feel like I have to learn it because if I don't I'm limited

What do

Why have Angular and the like and node become the meme the last few years.

i like that faker data.
> Hi I'm Batman Swallowhams. You can reach me at [email protected] - or at my store in Bald Knob, AZ

Does anyone know what's wrong with setting animation-duration using props in React?

const spin = keyframes`
0% {
transform: none;
will-change: transform
}
100% {
transform: rotate(360deg);
}
`;

const SpinGrad = styled.circle`
transform-origin: 50% 50%;
fill: url(#setGradient);
animation: ${spin} linear infinite;
animation-duration: ${props => aniDur};
`;


Using shorthand like animation: ${spin} {aniDur} linear infinite; doesn't work either.

Using Styled components if anyone is wondering/

From a coding point of view, constant variables tend to encourage a style that involves less bugs, because you know what it was when you assigned it, and it doesn't break somewhere along the line.

Languages that actually support immutability get performance gains. For example, they can usually garbage collect easier.

The horrible meme is when people confuse things and decide "immutable Javascript", where the language doesn't actually optimise for immutability, is for some reason more performant. No. You just get the first advantage there.

Figured it out.
I wasn't passing the props into SpinGrad like:

Doesn’t V8 and other similar JS engines optimize for const?

they try: benediktmeurer.de/2017/06/29/javascript-optimization-patterns-part2/

using const probably isn't a massive performance boost though

>react, angular and vue supposedly the most popular frontend frameworks
>impossible to find examples that arent tiny as shit
i want to see some actual real world usage dammit
especially how they wire it up to the backend, handling pages in non-SPA's etc

that makes me a little sick

whats the best code editor? / which code editor do you use?

sublimation

why not vim, does any programmer with a good job (not autistic) actually use it? and why not vscode?

You could create an endpoint to handle that specifically. Pass a letter to it then grab the returned data.

github.com/FreeCodeCamp/freecodecamp

Classes are whatever, but the codebase for the site is open source. Google is your friend.

Because people have different opinions on what they like? Just pick one you enjoy using and become comfortable with it. I personally use Sublime, but I have coworkers who use Emacs, Web Storm, VSCode, Vim, and others.

10 years webdev here, the average is vscode and some indeed stick with vim as they are too used / tied to it (but losing lots of features, like the vscode support for typescript)

your coworkers who use vim, are they autistic? do people who use a certain editor make more money? or are they more knowledgeable?

not much to say, some people just uses them to enrich their existing pages from rails or similar. That often ends up by having a huge monolith and you'll lose live reload and other goodies, so normally it's just best to have an api server and a separate node server to render the react/vue interfaces.

that way you can scale the two things independently and it's way more manageable

what else would you need to know? try to actual build a polished example and you'll clear your doubts

there arent many people using ides right?

Are you retarded?

yes some still do, I normally switch from vscode to pycharm / rubymine / intellij (prefer intellij as it contains pycharm and rubymine basically) or webstorm.. anyway that suite is worth, but vscode is quicker (and better for TS development)

why would i be? i just want to know more about available editors

which features make you use an ide? do you debug in an editor ?

vscode allows debugging in-editor but I prefer iron-node or chrome dev tools in general as they are much more powerful

With python/ruby indeed intellij makes the difference as it configures right away the project if you're using e.g. django, flask or Rails

Tests runners are configured automatically most of the times too, which is essential if you're dealing with many projects in many different languages

I also love acejump plugin which makes me work without touching the mouse basically, the intelisense is best on intellij for those languages, but on vscode as said it became better for JS autocompletion.

Both supports auto formatting so if you're using prettier (you should) and eslint you get your code standardized automatically (as you normally work on a team so it's pretty important to write code in the same way)

An editor is just an editor. People use a particular editor because it has some feature they like. People who like keybinds/macros often use Vim. I'm not a huge fan, but it make literally 0 difference in anything but your opinion.

VSCode doesn't do anything that Vim or any other editor can't do. I'm of the opinion that it is only popular because it looks decent by default, and comes with a few features pre-installed. Don't spread the meme that a particular editor allows you to do something other editors don't.

As I understand it, it's using more http methods than just GET and POST, like DELETE and PUT. So to delete user with id 123 you do a DELETE request to example.com/api/user/123, instead of doing a POST request with json data.

kid I've worked with visual studio, notepad++, vim, sublime, atom, intellij, netbeans, eclipse and now vscode

So "sorry" if I know as a fact that the intellisense / autocompletion of vscode for web (mainly JS or even better TS) it's definitely better than the others, maybe only webstorm/intellisense can compete but not much else.

keep dreamin'

Use mithril.js instead, then if you need to, come back to (vastly inferior) React and learn it to make you more employable

and btw I didn't said vim is not usable or you shouldn't use that. Simply stating the facts so you choose what to do, if you're confident and quick enough with vim stick to it, no one is ruining your birthday cake child

can someone explain to a noncodemonkey brainlet the problem with this

Angular empowers brainlet JS developers to make full-fledged applications within the client without learning anything about server side programming. Node lets those same brain let devs pretend they're serverside devs

it's mostly just a way of organizing your api paths, pretty much what said

restful:
>DELETE host.com/api/users/123

non-restful:
>GET host.com/api/deleteUser?id=123

in a restful api, the endpoint you hit is more predictable and follows a pattern.

Does anyone have info on how much a new business can benefit from a website upgrade, like statistics and shit to see how much it justifies the cost

it's written in a dynamically typed language

>kid
And while you've worked in a ton of IDEs, you've proven you have no fucking clue how any of them work. VSCode doesn't magically divine the auto completion/types for Typescript, it uses the Typescript language server. If you had any the slightest understanding of the tools you use, you'd know that.

>I-I knew that!

Then you also know that the language server protocol is standard, meaning the editor is fucking irrelevant. Intellisense is literally built on top of the language server, which is what every other editor uses to accomplish the same thing. Attempting to be condescending just makes you look like an edgy manchild.

step aside bois
function getConfirmed() {
return confirmed && !(confirmed = false);
}

Dub-a-tub-those-wigs-nags.

Frustrating humans.

confirmed is already a Boolean and in the same scope so why create a function that returns a booleans of a Boolean that's already in scope? the function is also needlessly complex

arent redux & friends just glorified global variables?

Am I LITERALLY the only ACTUAL Windows Power User In Existence?
//
難道我真的是唯一實際的Windows高級用戶存在?

First Linux User To Look Outside OF Torvald's Asshole./第一個Linux用戶要看看外面的托伐的混蛋。

yes. this is why I just use POJOs. I never really found Redux or Vuex as an elegant solution and I bet their popularity is mostly due to marketing

duh really?

ok now that you've some time to catch breath

Oh btw, vscode has a language server API that allows integrations between JS and TS in a unique way, which is obviously what I was referring too.

If you use 100% TS everywhere and puts types everywhere then yes, it's the same as the other ways of autocompletion. Too bad it's not the case for real life projects so the integration between the two is definitely noticeable

it's an architecture more than pure implementation, to force you to use one-way flows for your state, it helps writing more reusable code in a FP-like way, thus allowing easy testing too

how much do you bet?

> professionals with years of experience are dull
> things become popular because of marketing, just like what happens for MBPs
> I'm a graduate but I know best

literally Sup Forums

In heavily immutable programming you don't replace the item.

That wouldn't be very immutable after all.

What would you have me think about Vue.js?
I kinda like it, but is it relevant?

>if you put types everywhere
How else are you using Typescript? The ideal case is to use Typescript for an entire project. Unless you have a legacy project and you're progressively introducing Typescript, there is no reason why this isn't possible. Even if that is the case, however, you can just write interfaces for the exports from your JS codebase (which you'd have to do to use it with any degree of type safety anyways).

For "real life" projects, you would have control over everything I just said, so I still fail to see this holy grail of yours. Sure, if you are using a JS-only project, I guess it may be vaguely convenient to have some methods autocompleted for you. But I've used VSCode in a JS codebase, and it is far from perfect, especially when using refactoring tools like Rename Symbol.

What's everyone's opinion on ASP.NET. Is it telemetry ridden? I don't really want to go the PHP route for backend, and am familiar with C#

It is far easier to reason about immutable state in a large application. If you have a codebase where the state is shared among dozens of components, it can be difficult to track down an issue where the state is being changed in an unpredictable way. When the state is immutable, you have very strict control over the places where the state can be changed, and thus you have a far more predictable set of mutations that can occur.

Also, well-implemented immutability libraries (such as Facebook's ImmutableJS and Clojurescript's built-in immutable objects) won't actually copy the whole object. They will just create a new object that reuses the references from the old object, but changes the reference to which field was mutated. It is actually very fast.

refactoring is definitely better in Intellij family that's true.

> For "real life" projects, you would have control over everything I just said
that's never true, real life projects have limited bandwith for tech debt resolution and refactors so almost always the heavy refactors needs to be progressively done.

This applies for anything really, I've worked in codebases that had both andgular and react/redux for the same reason, and we managed to make the two parts talk to eachothers which gave us the time to deprecate Angular completely.

This doesn't happen always so most of the time you can't use TS everywhere. Not to count the fact that I don't like using TS for frontend code outside state management (e.g. React components) as it poses a barrier for junior devs as well forces every other developer to learn TS properly.

Duck typing has its reasons to stay where it is so why roll TS everywhere? The only sensible place I would use it 100% is when I'm creating NPM libraries either external or internal, and that's still subject to the client commissioning this and its capacity to modify the code with their internal developers

You can still do the second one in a badly designed rest server.

If a person knew nothing but HTML/CSS and JavaScript, how employable would they be?

Hell I've been considering jumping off the server side JS meme for a while, mostly because of scalability, performance, and the fact that shit changes every two seconds.

But the reality is that JS makes you incredibly profitable atm. And it will remain so for at least a few more years.

I think we've worked our way to common ground. For most of those situations where you have to integrate two codebases, you are still able to install types, but I can appreciate why you wouldn't. The noImplicitAny option exists specifically to deal with situations where you are progressively porting code. If you have a codebase you are handing over, you can just delete all the Typescript interfaces, and you will have Javascript. Typescript doesn't add anything at runtime, only compile-time.

Javascript doesn't have duck typing. It doesn't really have a type system at all, though I guess you could vaguely describe it as dynamically typed. If you wanted duck typing, that is the whole purpose of Typescript interfaces (if the shape of A satisfies the contract for B, then you can use A in place of B).

The best arguments against TS are the training costs and existing codebases. Other than that, I can't really see a reason not to use it (with the exception of quick-and-dirty demos).

To be explicit, I say JS doesn't have duck typing because it doesn't have structural typing, but they aren't the same thing. To have duck typing in JS, you have to implement it yourself by scattering various property checks everywhere.

It's one of the biggest cargo cults of webdev, which is itself absolutely full of cargo cults. The concept is nebulous and there are no actual standards. Just keep calls from depending on each other, restrict yourself to one call per path (arguments shouldn't route functionality), and don't mutate on GET. Also don't be afraid of doing RPC if it makes your life easier, and don't get caught up in dogma. Just focus on making your api.

bool getConfirmed {
return (confirmed = !confirmed);
}

You can probably make like $20 per month working for a tiny company. Front end developers are expected to know at least one of the big 3 frameworks nowadays, preferably angular or react.

So what's better
GET/DELETE ETC. on /API/user/
Or a single endpoint that performs an action based on input?
Eg. /API/
Request: {
Controller: a,
Action: do Thing,
Data: {}
}

If you know JS, you can pick up any other js-based frameworks in like 2 days, so just start applying now, dude

Christ, programming looks like a tedium!

Whats with this FOTM shit that goes on in webdev?

When I was in school part time was all Jquery. When I graduated it was all angular. Now every shop and their mother think react is the new hot shit. What gives? What purpose do any of these places have for moving to React when most of their devs already know or are comfortable with Angular?

job security

> knows JS
oh no you don't

Pajeets hate learning. Youre a Pajeet.

JSON? More like GAY-son!
ps. Stop writing code in JavaScript

It is very relevant in Asia and steadily getting more popular here.
Imo its the best of the big three but its not like companies are going to throw money around to change their frontend if their current one works well enough.

jQuery isn't enough anymore. It's not because it isn't trendy, it's because the more modern frameworks solve real problems that jQuery doesn't. Managing state and data flow play a big part of it.

express or django for a tinder like app?
from what point the performance will be much better on python?

Because:

It's retarded. Just learn whatever is used on the project you're assigned to.

def fizzbuzz(n):

if n % 3 == 0 and n % 5 == 0:
return 'FizzBuzz'
elif n % 3 == 0:
return 'Fizz'
elif n % 5 == 0:
return 'Buzz'
else:
return str(n)

print "\n".join(fizzbuzz(n) for n in xrange(1, 21))

...

You don't even ned a reason

Karena Aja/Kurang Ajara
由於父親/更少節日
Since Father / Less Festive
Sejak Bapak / Kurang Ajar

由於先生/減節日

Karena Aja = Just Because

Fairly good 'string/semantic' match. Clever Simon. Computer Science.

Oh, Novel Sizes Of Prizes.

But I'm asking for, please elaborate. It's simple and almost every modern website uses a bit of javascript code. It's quite popular and most hiring companies ask for a few js knowledge

How do you script 'Java' when it isn't a real word? He was born on the Isle Of Jawa.

你怎麼腳本的Java“時,它是不是一個真正的詞? 他出生在大島爪哇。

Is it possible to teach yourself web development with online resources and become employable within a year?

金舌操帝宮

是否可以教自己的web開發在線資源,並在一年內成為受僱?

what wordpress template is that

Potato Fucker 24567. OPtimized Faggotry.

Go back to Mexico