r/programming • • Jun 09 '16

jQuery 3.0 Released!

https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/
1.1k Upvotes

354 comments sorted by

131

u/Bl00dsoul Jun 09 '16

damn, and here i am still using 1.9

114

u/hammerha Jun 10 '16

Don't worry, even https://jquery.org/ still uses 1.11.3.

→ More replies (7)

41

u/judgej2 Jun 10 '16

The latest versions are for the cool young things and their fancy new browsers. Meanwhile, in the real world outside Silicon Valley, where sites have to work for everyone, their dog, and our parents...

26

u/habitual_viking Jun 10 '16

Jep, so much this.

Was recently asked about the jQuery we had and why we aren't upgrading, well.. we still got 6% IE 8 users (and even some IE6), with 13 million unique sessions a month, we can't really ignore 6% of potential revenue.

14

u/djxfade Jun 10 '16

I feel your pain. But don't worry, Windows 10 forced upgrade will solve this :P

→ More replies (9)
→ More replies (5)

6

u/TheWix Jun 10 '16

We have a lot of customers in the middle east still on XP and IE 7... Older JQuery for us...

23

u/Dimasdanz Jun 10 '16

1.9? Try 1.6

27

u/prondose Jun 10 '16

1.4.2 here :\

21

u/doiveo Jun 10 '16 edited Jun 10 '16

You aren't alone.

EDIT:jQuery 1.4.2 - 2,561,262 websites. The biggest single release by use.

→ More replies (2)
→ More replies (2)

6

u/[deleted] Jun 10 '16

Our CMS prebakes a version of jQuery into the load - so we are fixed with 1.11.3. So we double down on it with the latest and the old.

→ More replies (2)

3

u/irukesu Jun 10 '16

Some sections still use 1.3.4, /shutters/

23

u/smith288 Jun 10 '16

Gonna remote into production today and update! Just change the 1.4 to 3.0, correct?

13

u/legec Jun 10 '16

Don't forget to turn your html tags to lowercase (to be more XHTML compliant). If you have perl installed on your production servers, it's just a simple regexp though.

12

u/smith288 Jun 10 '16

Yeah, I could just run this.

preg_replace('/<[>]*>/', '', $content)

15

u/BonzaiThePenguin Jun 10 '16

How do I make my code jump up in the air like that?

4

u/[deleted] Jun 10 '16

Don't forget to minify the file by removing all the backspaces!

33

u/chewitt Jun 10 '16 edited Jun 10 '16

Layout is broken on my android chrome... not a great sign

Edit: needs an "overflow: scroll" on code blocks

5

u/GYN-k4H-Q3z-75B Jun 10 '16

Layout is also broken on Windows 10 Edge.

→ More replies (1)

87

u/rakesh11123 Jun 10 '16

Can you add numbers in this release?

140

u/Shadowhawk109 Jun 10 '16
 var temp = 2 + "two";
 Console.log(temp);

 >:potato emoji:

45

u/outadoc Jun 10 '16

🍠

Here

9

u/AlGoreBestGore Jun 10 '16

Except that "console" is lowercase.

→ More replies (1)

21

u/gerrywastaken Jun 10 '16

I'm embarrassed that I don't get this joke. What do you mean?

95

u/[deleted] Jun 10 '16

40

u/El_Impresionante Jun 10 '16

Guys, I wrote this function to jQuery to do just that. How do I get the jQuery devs to include it in the main library?

function $_add(n1, n2) {
    result = null;
	$.ajax({
		url : "https://www.google.com/search?q=" + n1.toString() + "%2B" + n2.toString(),
        context: document.body
	})
    .done(function() {
        result = parseInt($(this).find("#cwcot").text());
    });
    return result;
}
→ More replies (3)

22

u/sgraf812 Jun 10 '16

It's this one

-1 not enough jQuery

14

u/sarmatron Jun 10 '16

StackOverflow does shitposts now?

30

u/[deleted] Jun 10 '16

It's not a real post, just a joke.

→ More replies (1)
→ More replies (2)
→ More replies (3)

58

u/amclennon Jun 10 '16

Despite how far we've come in terms of browser standards and compatibility, I think jQuery's biggest strength is still its ability to handle edge cases.

The other day I ran into a very obscure bug with document.querySelectorAll(selector) that $(selector) handled just fine.

67

u/[deleted] Jun 10 '16 edited Mar 07 '24

I̴̢̺͖̱̔͋̑̋̿̈́͌͜g̶͙̻̯̊͛̍̎̐͊̌͐̌̐̌̅͊̚͜͝ṉ̵̡̻̺͕̭͙̥̝̪̠̖̊͊͋̓̀͜o̴̲̘̻̯̹̳̬̻̫͑̋̽̐͛̊͠r̸̮̩̗̯͕͔̘̰̲͓̪̝̼̿͒̎̇̌̓̕e̷͚̯̞̝̥̥͉̼̞̖͚͔͗͌̌̚͘͝͠ ̷̢͉̣̜͕͉̜̀́͘y̵̛͙̯̲̮̯̾̒̃͐̾͊͆ȯ̶̡̧̮͙̘͖̰̗̯̪̮̍́̈́̂ͅų̴͎͎̝̮̦̒̚͜ŗ̶̡̻͖̘̣͉͚̍͒̽̒͌͒̕͠ ̵̢͚͔͈͉̗̼̟̀̇̋͗̆̃̄͌͑̈́́p̴̛̩͊͑́̈́̓̇̀̉͋́͊͘ṙ̷̬͖͉̺̬̯͉̼̾̓̋̒͑͘͠͠e̸̡̙̞̘̝͎̘̦͙͇̯̦̤̰̍̽́̌̾͆̕͝͝͝v̵͉̼̺͉̳̗͓͍͔̼̼̲̅̆͐̈ͅi̶̭̯̖̦̫͍̦̯̬̭͕͈͋̾̕ͅơ̸̠̱͖͙͙͓̰̒̊̌̃̔̊͋͐ủ̶̢͕̩͉͎̞̔́́́̃́̌͗̎ś̸̡̯̭̺̭͖̫̫̱̫͉̣́̆ͅ ̷̨̲̦̝̥̱̞̯͓̲̳̤͎̈́̏͗̅̀̊͜͠i̴̧͙̫͔͖͍̋͊̓̓̂̓͘̚͝n̷̫̯͚̝̲͚̤̱̒̽͗̇̉̑̑͂̔̕͠͠s̷̛͙̝̙̫̯̟͐́́̒̃̅̇́̍͊̈̀͗͜ṭ̶̛̣̪̫́̅͑̊̐̚ŗ̷̻̼͔̖̥̮̫̬͖̻̿͘u̷͓̙͈͖̩͕̳̰̭͑͌͐̓̈́̒̚̚͠͠͠c̸̛̛͇̼̺̤̖̎̇̿̐̉̏͆̈́t̷̢̺̠͈̪̠͈͔̺͚̣̳̺̯̄́̀̐̂̀̊̽͑ͅí̵̢̖̣̯̤͚͈̀͑́͌̔̅̓̿̂̚͠͠o̷̬͊́̓͋͑̔̎̈́̅̓͝n̸̨̧̞̾͂̍̀̿̌̒̍̃̚͝s̸̨̢̗͇̮̖͑͋͒̌͗͋̃̍̀̅̾̕͠͝ ̷͓̟̾͗̓̃̍͌̓̈́̿̚̚à̴̧̭͕͔̩̬͖̠͍̦͐̋̅̚̚͜͠ͅn̵͙͎̎̄͊̌d̴̡̯̞̯͇̪͊́͋̈̍̈́̓͒͘ ̴͕̾͑̔̃̓ŗ̴̡̥̤̺̮͔̞̖̗̪͍͙̉͆́͛͜ḙ̵̙̬̾̒͜g̸͕̠͔̋̏͘ͅu̵̢̪̳̞͍͍͉̜̹̜̖͎͛̃̒̇͛͂͑͋͗͝ͅr̴̥̪̝̹̰̉̔̏̋͌͐̕͝͝͝ǧ̴̢̳̥̥͚̪̮̼̪̼͈̺͓͍̣̓͋̄́i̴̘͙̰̺̙͗̉̀͝t̷͉̪̬͙̝͖̄̐̏́̎͊͋̄̎̊͋̈́̚͘͝a̵̫̲̥͙͗̓̈́͌̏̈̾̂͌̚̕͜ṫ̸̨̟̳̬̜̖̝͍̙͙͕̞͉̈͗͐̌͑̓͜e̸̬̳͌̋̀́͂͒͆̑̓͠ ̶̢͖̬͐͑̒̚̕c̶̯̹̱̟̗̽̾̒̈ǫ̷̧̛̳̠̪͇̞̦̱̫̮͈̽̔̎͌̀̋̾̒̈́͂p̷̠͈̰͕̙̣͖̊̇̽͘͠ͅy̴̡̞͔̫̻̜̠̹̘͉̎́͑̉͝r̶̢̡̮͉͙̪͈̠͇̬̉ͅȋ̶̝̇̊̄́̋̈̒͗͋́̇͐͘g̷̥̻̃̑͊̚͝h̶̪̘̦̯͈͂̀̋͋t̸̤̀e̶͓͕͇̠̫̠̠̖̩̣͎̐̃͆̈́̀͒͘̚͝d̴̨̗̝̱̞̘̥̀̽̉͌̌́̈̿͋̎̒͝ ̵͚̮̭͇͚͎̖̦͇̎́͆̀̄̓́͝ţ̸͉͚̠̻̣̗̘̘̰̇̀̄͊̈́̇̈́͜͝ȩ̵͓͔̺̙̟͖̌͒̽̀̀̉͘x̷̧̧̛̯̪̻̳̩͉̽̈́͜ṭ̷̢̨͇͙͕͇͈̅͌̋.̸̩̹̫̩͔̠̪͈̪̯̪̄̀͌̇̎͐̃

→ More replies (1)

13

u/[deleted] Jun 10 '16

The other day I ran into a very obscure bug with document.querySelectorAll(selector) that $(selector) handled just fine.

I imagine that things could go wrong if you're doing really complex selectors. But at that point, you have to question what in the hell you're doing that requires you to select such complex selectors. Is your codebase too complicated for its own good, or does the project have complicated enough interactions that you'd be better off going for React anyway?

43

u/jesusthatsgreat Jun 10 '16

jQuery.... pahh... only losers use jQuery. I'm infinitely more productive using a combination of Mustache, Knockout, Meteor, Backbone, Ember, Gulp, Redux, nodeJS, Angular & React.

30

u/sd522527 Jun 10 '16

Hah, look at this guy, using &. Everyone knows % is where it's at!

17

u/[deleted] Jun 10 '16

The scary part is that I am not even 100% sure this is sarcastic...

→ More replies (1)
→ More replies (3)

10

u/Arancaytar Jun 10 '16 edited Jun 10 '16

Firefox: Current and current - 1

This seems insanely limited. At this time, the previous Firefox version came out in March on April 26, six weeks ago.

Hell, with that version requirement you can pretty much use full ES6. Is this library seriously meant to be used in production sites without Babel?

Edit: At the time of this release (June 9) Firefox 47 had been out for two days, so "current / current - 1" strictly speaking refers to 46+, even if that's not the intended meaning.

2

u/FalzHunar Jun 10 '16

Modern browsers are evergreen (auto-updating) so compatibility wouldn't be an issue.

5

u/Arancaytar Jun 10 '16

Well, I checked my site logs for today and these are the ten most popular Firefox version strings:

     63 Firefox/40.1"
     73 Firefox/14.0.1"
    101 Firefox/44.0"
    118 Firefox/45.0"
    181 Firefox/43.0"
    231 Firefox/47.0"
    257 Firefox/35.0"
    411 Firefox/21.0"
    417 Firefox/34.0"
   1903 Firefox/46.0"

Just out of those, the current Firefox version (47) makes up 6%, and the most recent two versions (46 and 47) make up 57%.

More than a third seem to be lagging by over a year. That doesn't make me very confident that I can rely on "46+" any time soon, and "current/current-1" possibly never.

12

u/CombiFish Jun 10 '16

Will this solve all my problems if I use enough of it?

9

u/tbonetexan Jun 10 '16

I do all my programming in XML.

21

u/duuuh Jun 10 '16

I had a friend who used to troll upper engineering management by saying things like "I think we can solve that with XML." He hated XML with a passion and thought they were all retarded, so the lack of push-back confirmed all of his biases.

43

u/earthboundkid Jun 09 '16

Most of what I used jQuery for was working around browser incompatibility. As IE11 becomes the trailing edge browser we need to support, the need for jQuery shrinks to zero. Once fetch becomes universal, there's not really anything left.

128

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

As IE11 becomes the trailing edge browser we need to support, the need for jQuery shrinks to zero.

Not true, because they can slim down jQuery (as you see with 3.0) which still allows you to turn what might be 20 lines of ECMA-compliant JavaScript into a one-liner that even assures you much better compatibility.

It's still useful, as long as it's not bloated, and fast.

It makes your own code more readable ... the whole "DRY principle".

This?

var d = document.getElementsByClassName("goodbye");
var i; 
for (i = 0; i < d.length; i++) { 
  d[i].className = d[i].className + " selected";
}

Or?

$(".goodbye").addClass("selected");

52

u/stns_da_mnns Jun 10 '16

Someone who gets it! There are far worse things to do than include jQuery to make your webpage slower. Who needs 4K images on a focking phone?

61

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

Yes. I try to explain it, people don't get it.

And by "people" I mean "developers" which makes it even more frightening.

Sadly, as a senior developer I've had to lay people off after I asked them, politely, numerous times to please stop trying to squeeze out the extra 15 milliseconds of some function that runs once a day and focus on the real problems on the list.

And not "Lumberg" politely ... just trying to explain that it is not a priority and we have bigger problems. It sucked. But soooo many people do this.

Because if you can shave it from 30 ms to 15 ms ... that's twice as fast. To the one person who might run it, once a day.

"But you have to pull in the whole library!".

Yes, well your logo in the top left corner is twice the size of jQuery and could be 100 times smaller and look the same.

Oh, and jQuery wasn't actually downloaded as you can see in the developer tools network panel ... it's cached on almost everyone's machine.

25

u/[deleted] Jun 10 '16

The three things you don't bring up at the dinner table: religion, politics, and jQuery.

→ More replies (1)
→ More replies (7)

12

u/puhnitor Jun 10 '16 edited Jun 10 '16
[...document.querySelectorAll('.goodbye')].forEach(goodbye => goodbye.classList.add('selected'));

80

u/EternalNY1 Jun 10 '16

forEach

Yes if you want all versions of IE dropped as well as Safari.

Or bring in jQuery, small and fast and almost guaranteed to be cached locally anyway, and get it fully compatible in 1 (shorter) line without the lambda "arrow function".

So, in your case, we'd have (works on some browsers):

[...(document.querySelectorAll('.goodbye')].forEach(goodbye => goodbye.classList.add('selected'));

Works on almost all browsers:

$(".goodbye").addClass("selected");

15

u/Elsimir Jun 10 '16

forEach is the least of the compatibility problems there too, there's a spread operator and an arrow function.

→ More replies (1)
→ More replies (35)

10

u/thebuccaneersden Jun 10 '16

that... that does not look as clean... just sayin...

24

u/EternalNY1 Jun 10 '16
  • Not as clean

  • Not as compatible

All fixed in a 34kb lib that likely will not even be downloaded because the client already has it.

4

u/earthboundkid Jun 10 '16

That's flashy, but even just querySelector basically does the hard part that jQuery used to do.

→ More replies (4)

1

u/kyebosh Jun 10 '16

I mean, let's not forget the 34KB library. It's not quite as clear-cut as your little example. For a light page were size & speed are paramount, you're damn right I choose the former. Just because you didn't write the code yourself doesn't mean it's not there.

25

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

34KB!!!!

I used to run a PcBoard BBS in the late 80s on a 14.4k dial-up.

34KB mattered then.

As a simple example, I just checked a few pages with (incognito, no cache, Chrome dev tools network usage):

  • Reddit: 405KB

  • CNN: 1.4 MB

  • Yahoo: 2.9 MB

  • Netflix: 3.1 MB

Are we seriously discussing 34KB that, if I wasn't clearing the cache here, would be 0?

jQuery is 1% of the Netflix homepage, in the slim chance it even needs to be downloaded at all!

Pre-optimization (or totally incorrect fake "optimization") is one of the worst things in software engineering.

EDIT: I also have Ghostery and Adblock installed, I shudder to think what those numbers would look like if I was pulling the ads and beacons.

→ More replies (22)
→ More replies (19)

33

u/HokumGuru Jun 10 '16

TIL fetch omg

66

u/kupiakos Jun 10 '16

Stop trying to make fetch happen! It's not going to happen!

→ More replies (2)

9

u/[deleted] Jun 10 '16

You can use fetch today https://github.com/github/fetch

9

u/kovensky Jun 10 '16

The main problem with fetch is that it's not cancelable -- but on the majority of use cases you don't need cancellation anyway :D

→ More replies (2)

4

u/sparr Jun 10 '16

As IE11 becomes the trailing edge browser we need to support

Please tell me this is a real thing, somewhere in the world.

I left a job late last year where we were discussing dropping support for IE6. This was at an entertainment website company.

10

u/gearvOsh Jun 10 '16

Uh what? Every company I've worked for dropped IE6 over 4 years ago. IE8 was dropped about 1-2 years ago. IE9 is next.

Whatever company you are working for has no idea what they are doing, except for the instance where their actual traffic comes from those browsers.

4

u/earthboundkid Jun 10 '16

Yeah, IE6 is really just an unpleasant memory at this point. We stopped at IE7 in 2013, 8 in 2014, and jumped to 11 at the end of last year.

→ More replies (5)
→ More replies (2)

6

u/kevrom Jun 10 '16

Fetch is a simple polyfill (or 2) away. So ajax is not a valid excuse to include jQuery. Complex animations with jQuery are probably much easier than most counterparts, but that's about all I can think of really.

9

u/omnius19 Jun 10 '16

Check out gsap for complex animations. If you are coming from jQuery animations, it will blow your mind.

2

u/destraht Jun 10 '16

As far as I know Fetch doesn't support timeout callbacks and stuff like that.

3

u/R4vendarksky Jun 10 '16

So much this. If you don't need 1.12 then you are probably only needing jquery because some libraries you want to use depend on it.

13

u/sevvy325 Jun 10 '16

So I'm just starting to learn web development, and I thought JQuery was pretty standard? What's the more popular choice?

→ More replies (5)
→ More replies (2)

17

u/losangelesvideoguy Jun 10 '16

Not to be confused with Jake Weary.

→ More replies (1)

9

u/[deleted] Jun 10 '16

But the question is, is it web scale?

6

u/EternallyMiffed Jun 10 '16

It must be, since it supports Sharding.

7

u/[deleted] Jun 10 '16

The similarities with Python 3 are striking:

It is a continuation of the 2.x branch, but with a few breaking changes that we felt were long overdue. While the 1.12 and 2.2 branches will continue to receive critical support patches for a time, they will not get any new features or major revisions. jQuery 3.0 is the future of jQuery. If you need IE6-8 support, you can continue to use the latest 1.12 release.

→ More replies (2)

2

u/zelnoth Jun 10 '16

Time to update some stack overflow answers.

9

u/deus_lemmus Jun 10 '16

Oh great, more noise on stack overflow when I search for a vanilla js answer.

9

u/[deleted] Jun 10 '16

Vanilla js IS the answer! :D

7

u/printers_suck Jun 10 '16

Maybe you should use jquery

1

u/wen96 Jun 13 '16

Friday! Best day to deploy new versions.

0

u/[deleted] Jun 09 '16

[deleted]

7

u/AngularBeginner Jun 10 '16

Do you write unit tests for your code?

13

u/prewk Jun 10 '16 edited Jun 10 '16

No, you see, unit tests and React are for hipster developers*.

* code word for people who have evolved in their field the last 5-10 years or so.

3

u/dacjames Jun 10 '16

Who needs unit tests when you can just write perfect code the first time?

13

u/[deleted] Jun 10 '16

What is Simple Java?

13

u/[deleted] Jun 10 '16

Spring Doot

9

u/forreddits Jun 10 '16

all I could think of is that he is just using plain servlets.

3

u/korri123 Jun 10 '16

Rapidoid

4

u/sofia_la_negra_lulu Jun 10 '16

You forgot Typescript in the mix.

8

u/douglasg14b Jun 10 '16

Angular took some time to get used too, however now that I am familiar with its nuonces and paradigms, I end up being pretty productive. It's just so bloody easy and fast to setup at this point, not having to worry about a ton of DOM manipulation saves me loads of time and effort, not to mention a few thousand lines of JS.

Then again, I'm talking about fairly dynamic SPAs, it's completely unnecessary for more static sites.

8

u/svmk1987 Jun 10 '16

You only need Angular and React for really complex front-end apps. That is when they start becoming more useful and productive than simple jquery. Angular and react aren't a one stop solution for all front-end engineering problems. Your coworkers are probably treating them as such.

But yeah, if you try to get away with only jquery and no proper front-end framework for a complex front-end application, you can end up in a hot mess.

8

u/[deleted] Jun 10 '16

The point is, how productive will you be when you need to modify your code in 3 years from now.

3

u/foobar5678 Jun 10 '16

Exactly this. You might be able to hack something together with jQuery in 5 hours whereas it will take me 10 hours in Angular. But I'll have unit tests, well organized code (instead of one massive file), and reusable components. When you spend 10 hours in the future trying to fix bugs or add a feature, and I spend 2 hours doing it, I come out on top.

Doing things quickly today doesn't usually save you time in the long run.

→ More replies (1)

8

u/darkpaladin Jun 10 '16

Different strokes for different folks. I'm about equivalently productive on each but the more complicated the front end is the more I shy away from jQuery into React if it's just rendering complexity or maybe Angular if its a full scale front end app. In my experience though 99/100 Angular is overkill for what you need.

The biggest challenge when dealing with front end frameworks like React is the speed at which things become unsupported. We adopted a flux library 6 months ago and now no one wants to talk about anything but Redux. If you're trying to stay on the bleeding edge, you'll find yourself in a constant rewrite/refactor loop which is probably the productivity loss you're talking about.

4

u/m3l7 Jun 10 '16

more productive spaghetti

2

u/NoDownvotesPlease Jun 10 '16

I've been able to write some lovely convoluted spaghetti with angular just as easily :)

2

u/DuoThree Jun 10 '16

typescript on his sweater already

1

u/DJDarkViper Jun 10 '16

depends on the task, I found myself at least equally more productive with less code when using Angular. But I stress equally. I can use jQuery just fine a shit out a component or background loaded data table just as fast as I can in Angular :/ I appreciate the orgabization if Angular though.

I sint even know what im getting at anymore.

1

u/csharpcheddar Jun 10 '16

Sounds like jQuery is just a small part of this comparison betweensoftware stacks

1

u/kirbyfan64sos Jun 10 '16

IMO the problem isn't necessarily with React, but with the fact that people have a tendency to use it for everything they right. Some things just really don't need it.

1

u/thrilldigger Jun 10 '16

Websockets + vanilla Java is painful. Boilerplate for days.

Spring for life.

-22

u/[deleted] Jun 09 '16

a snark remark about Angular, React, and MongoDB. So original.

Lemme take a peak at that productive front end codebase of yours. You must be a swell to work with.

22

u/ThePsion5 Jun 10 '16

I was going to think of a snarky comeback, but it was updated while I was iterating over the collection so I forgot about it.

-23

u/QuicklyStarfish Jun 09 '16

What are you using jQuery for?

It seems entirely obsolete.

18

u/cogman10 Jun 09 '16

For a one and done webpage, it is hard to beat a JS blob and some Jquery tying it together. It still provides you with a lot of cross browser support and some nifty functionality that is more verbose to do raw. (That being said, the need for it is vastly reduced now that most browsers are pretty modern).

But for anything more complex and webappy, you probably want something more frameworky like React, Angular, Ember, Vue, Mythril, etc.

→ More replies (1)

0

u/[deleted] Jun 09 '16

[deleted]

20

u/SimplyBilly Jun 10 '16

I use React + Redux for fronted work as well and Java + PostgreSQL for the backend. For larger projects it makes life so easy compared to jQuery.

6

u/lalwanivikas Jun 10 '16

I use Postgres too though, so maybe the type of developer who reaches for MongoDB just isn't very good.

I am learning front-end dev and need to pick a db to learn so that I can make full apps now instead of just client side apps. Was actually planning to go with Mongo(w/o a good reason though), but I am confused after your comment.

Is Mongo that bad? If yes, then what should I learn instead? Postgres?

PS: I can understand JS, Node and stuff, but I know absolutely nothing about db :(

50

u/Prizephitah Jun 10 '16

If you know nothing about databases I would strongly suggest Postgres as your first encounter. Where it does many things right, Mongo does many things weird and comes with pretty bad defaults making it a bad learning experience.

Postgres is tried and tested. It's also well supported and pretty easy to work with. You pretty much can't go wrong with Postgres as a first encounter with databases.

Always use prepared statements!

4

u/judgej2 Jun 10 '16

It's not even as simple as which of the two are better. They are built on entirely different concepts, so reading up on relational databases and NoSQL databases is going to be important.

→ More replies (1)
→ More replies (12)

23

u/kqr Jun 10 '16

Unless you have a specific requirement that makes some other database more relevant, always default to Postgres. It is really, really good. Often better than it gets credit for.

3

u/lalwanivikas Jun 10 '16

Thanks kqr! Want to ask the same question that I posted above:

Any good resources that you can recommend for beginners?

(For server-side I just know Node)

9

u/lubricin Jun 10 '16

Perhaps code schools intro to SQL might be good? https://www.codeschool.com/courses/try-sql or just diving into the postgres manual here: https://www.postgresql.org/docs/9.5/static/tutorial.html

and heres some exercises that might be worth doing: https://pgexercises.com/

If you're using os x you can install it either with homebrew or just by launching the app you'll find here: http://postgresapp.com/

And here's a client for connecting node to postgres: https://github.com/brianc/node-postgres

→ More replies (1)
→ More replies (2)

4

u/[deleted] Jun 10 '16

It depends on your use case, mongo has certain drawbacks that may not be bad for certain application but killer for others. Traditional sql dbs have a very firm principal to keep the integrity of data, no matter what happens. To achieve this there are many technologies at work (transaction, process isolation, constraints.....) that require performance. Many of the first nosql dbs did away with these to be faster (i.e. MongoDB). Data loss is traditionally not something that is ok, but it can be, if you are developing a web crawler that gathers huge amounts of data, a loss of 0.0001% can be a great deal for the added performance. But if you save user data, you can not afford this freedom, you need 100%. Another thing i read last week is, if you query data in mongodb as it is updated, there is a real chance that this will not be in the result even if it matched your criteria before and after the update.

→ More replies (1)

4

u/Frodolas Jun 10 '16

Yeah I use React, Redux, Node, and Postgres and I'd say I'm pretty productive.

→ More replies (1)

0

u/[deleted] Jun 09 '16

[deleted]

81

u/JoeCraftingJoe Jun 10 '16

Is it webscale ???

79

u/nvolker Jun 10 '16

23

u/k3ithk Jun 10 '16 edited Jun 10 '16

I've never seen this and I burst out laughing at "you just turn it on and it scales right up."

→ More replies (1)

6

u/sizl Jun 10 '16

i love the rails vs. php one. so accurate.

→ More replies (4)
→ More replies (1)
→ More replies (5)
→ More replies (1)

0

u/[deleted] Jun 09 '16

[deleted]

22

u/[deleted] Jun 10 '16 edited Jun 10 '16

Angular isn't designed for every website out there. If you have a relatively simple site or if your site consists of mainly static content then you don't need to use a SPA framework. Your typical MVC framework with a mixture of jQuery will be fine.

9

u/robin_reala Jun 10 '16

Not only don’t need to, but shouldn’t.

5

u/rDr4g0n Jun 10 '16

When building a large web app touched by 50+ different devs (almost entirely NOT UI devs) over 2 or 3 years, a heavily opinionated framework is a godsend.

6

u/[deleted] Jun 10 '16

Angular is really good when it fits into its use case. It's a monolithic SPA framework, if you need a 100% client side web app that consumes your API and has a lot of complex UI interactions, Angular has fit the bill every time for me.

14

u/tgfisher Jun 09 '16

If you haven't already, try Vue.js. It's a nice middle ground between Angular/React and jQuery.

87

u/buddybiscuit Jun 10 '16

I would only use Vue.s if you use Gulp to package it into a Gruntfile with the React/Redux/Tridux/Quadrux core wrapped in the Ember framework and then transpile it using Smoosh.js into Potatoscript. But that's just my preferred stack.

44

u/SemiNormal Jun 10 '16

Haven't you heard? It's all NPM sciptify-node-pack now. You are like two weeks out of style. Get a grip.

4

u/[deleted] Jun 10 '16

Is grip the new hot thing?

/s

→ More replies (3)

13

u/cogman10 Jun 09 '16

I thought React was pretty minimal though. There isn't much more to trim away from it is there?

3

u/tgfisher Jun 09 '16

I love React but if you're wanting to move out of jQuery, Vue.js is a nice stepping stone to React and really shines as a framework that is easy to get up and running and fun to develop on.

13

u/[deleted] Jun 10 '16

Easy and fun eh?

War is easier than maintaining js project.

2

u/redalastor Jun 10 '16

I'm a fan of Mithril.js, you can do pretty much everything you can in React with a very small API.

2

u/TheWix Jun 10 '16

I will check Vue out. I have been using Knockout because most of the time I just need databinding with a sprinkle of templates. Add Typescript and I no longer have the infuriating bugs caused by assigning to an observable like this: myVar = 1

Rather than this: myVar(1)

4

u/judgej2 Jun 10 '16

I'm mostly backend, but am full stack to get the administration pages up. I tried knockout last year, and vue recently. Vue feels more intuitive and easier to get into, and found it easier to debug. I don't have and specifics, it's just a general feel.

→ More replies (1)

0

u/[deleted] Jun 10 '16

[deleted]

18

u/ngstyle Jun 10 '16

B... but relational DBs are not WEBSCALE.

5

u/[deleted] Jun 10 '16

MongoDB is CouchDB with all of the interesting features removed. What's the point of NoSQL if you remove all of the wacky document stuff and treat it like SQL? It's like buying a Tesla and then putting a gas engine back into it.

5

u/vbullinger Jun 10 '16

I have an i3 with the range extender :P

2

u/[deleted] Jun 10 '16

ha. I meant replacing the electric motor with an engine.

→ More replies (1)

0

u/[deleted] Jun 10 '16

[deleted]

3

u/madcaesar Jun 10 '16

How do you handle form validation? I've always used the jquery validate plug-in and it makes validation a breeze. Can you integrate it into react? If not what do you use?

3

u/lurkingforawhile Jun 10 '16

There are libraries out there that are really nice to use for this. Redux-Form is a great one, I use it on anything more than basic stuff.

2

u/douglasg14b Jun 10 '16 edited Jun 10 '16

Not op, but I rolled my own validation scheme, it just requires me to have a validation config that lists the input names, type, and validation types/patterns/expressions. With Angular, I can just use directives on inputs, and plug that into the validation flow so inputs can be validated on change, or whatever other event I want. Though, it does require JQuery.

I've been using it in just about everything I do now, it's been quite handy.

1

u/TheWix Jun 10 '16

Ooooh! I have been dying to ask a seasoned redux dev. So, I have been looking at Flex and Redux a lot but the whole idea of what appears to be global state looks pretty smelly, but I have to be missing something since it is so damn popular. I just can't get over the fact that this reminds me of session state on the server.

3

u/1xltP3mgkiF9 Jun 10 '16

Every time you write an app you have some state. Whether it's explicit or implicit and hidden behind a framework. In case of Redux the "state" is a linear list of sequential one single values. Every action modifies the whole state and produces new state. This makes the unit testing trivial and very simple.

→ More replies (4)

1

u/yooossshhii Jun 10 '16

Thats not a question..

2

u/TheWix Jun 10 '16

Yep, I phrased that wrong. I guess it is more of a desire to have my assumptions proved incorrect by someone who actually works with it.

→ More replies (1)
→ More replies (8)

0

u/[deleted] Jun 09 '16

[deleted]

129

u/JAPH Jun 09 '16

jQuery is still relevant? O_o

... said /u/Vizkos on the site using jQuery.

47

u/oponito Jun 09 '16

Brutal takedown of Vizkos.

14

u/madcaesar Jun 10 '16

Vizkos asshole has been shattered into a million pieces.

3

u/Andersmith Jun 10 '16

This post alone sent him into negative karma.

8

u/sdawson26 Jun 10 '16

Classic Vizkos.

17

u/[deleted] Jun 09 '16 edited Feb 15 '25

[deleted]

10

u/Hoten Jun 09 '16

Software moves fast, but not that fast.

5

u/DrMonkeyLove Jun 10 '16

Yeah, I mean, C is still relevant after all.

13

u/nvolker Jun 10 '16

It's pretty crazy how prevalent C and C++ are. If you're not writing in one of the other, you're probably writing code for an interpreter that was.

2

u/[deleted] Jun 10 '16

or code that is compiled into C :'( why do companies write their own languages..

4

u/SquireCD Jun 10 '16

Facebook's HackLang comes to mind as the most stupid named ever.

Sure, there's BrainFuck and others, but those are supposed to be jokes. HackLang is serious. And sad.

Admittedly, an improvement on PHP, though.

0

u/[deleted] Jun 09 '16

[deleted]

18

u/[deleted] Jun 09 '16

jQuery's simplified AJAX interface and DOM traversal/manipulation API is still very attractive to a lot of less experienced devs.

4

u/kageurufu Jun 10 '16

Fetch is nicer than jquery.ajax IMO, but the domain traversal stuff is unbeatable

3

u/[deleted] Jun 10 '16

I agree. I haven't used jQuery in a while now, but it still has its merits.

2

u/TheBasil88 Jun 10 '16

I'm confused by this, i use jquery all the time. Not so much for major applications but for site flavoring like masonry or parrallax. Do the frameworks do these sorts of manipulations better?

I can understand for ajax but when all i need is the next 20 rows on a button click angular seems like overkill

2

u/[deleted] Jun 10 '16

Certain frameworks build structured applications far better than jQuery does. I would argue that experienced developers are generally in the business of building websites that are more application-like. I would also argue that more experienced developers know how to get the next 20 rows in vanilla JS, and don't need to include an entire lib for just a couple of methods.

jQuery is perfectly fine when you're doing relatively simple things, or when you don't understand how to implement traversals with the standard DOM API.

1

u/TheBasil88 Jun 10 '16

Thanks for the info. I always want to try angular.js in a project but working for an advertising agency the apps very few if ever.

1

u/kolten_s Jun 10 '16

RIP Karma