program story

프로토 타입 VS jQuery-강점과 약점?

inputbox 2020. 11. 19. 08:08
반응형

프로토 타입 VS jQuery-강점과 약점?


다른 " Yet Another Js VS Js "스레드 를 열고 싶지 않습니다 .

결국 Prototype과 jQuery는 모두 JS이고 거의 동일한 방법과 기능을 가지고 있으며 동일한 작업에 대해 거의 동일한 코드 줄이 필요합니다.

실제 리치 인터넷 애플리케이션의 경우 Prototype 대 jQuery 실제 강점약점무엇 입니까?


처음에는 새롭거나 수정 된 메서드로 Prototype의 확장 요소에 대한 아이디어가 마음에 들었습니다.

그러나 이것이 나쁜 일 (TM) 인 여러 가지 이유를 발견했습니다.

인터넷 검색을하면 아마도 다른 이유를 찾을 수있을 것입니다.하지만 주된 이유는 다른 라이브러리가 요소와 메서드의 동작이 "표준"이 될 것으로 예상하기 때문에 Prototype이 다른 프레임 워크 또는 라이브러리와 "잘 작동"한다고 보장 할 수 없기 때문입니다. 그리고 Prototype이하는 일 때문에, 당신은 그것에 의해 깨지는 많은 것들을 발견 할 수 있습니다.

내가 발견 한 가장 최근의 예는 JSON 및 stringify를 사용한 프로토 타입 나사 고정이었습니다. EasyXDM을 사용하고 있었는데 prototype.js 라이브러리가로드 된 경우에 작동하지 않았습니다. 나는 다른 사람들 이 사용할 프레임 워크를 작성 하고 있었기 때문에 페이지의 내용을 제어 할 수 없었기 때문에 prototype.js와 같은 것이 혼란스럽지 않도록하기 위해 IFRAME에서 모든 것을 만들고 수행해야했습니다. 내가하려는 것.

... 그래서 jQuery가 저에게 유리합니다. 왜냐하면 저는 프레임 워크가 DOM과 자바 스크립트의 표준 동작을 자동으로 망칠 수 있다고 생각하지 않기 때문입니다. 당신은 이러한 것들을 통제해야합니다. Prototype은 당신에게서이 통제권의 일부를 빼앗 깁니다 ....


프로토 타입보다 jQuery를 사용합니다. 이유는이 페이지의 상단을 참조하십시오.

jquery 태그 질문 : 531,752
프로토 타입 태그 질문 : 2,465
업데이트 2014 년 9 월 22 일, 2011 년 12 월 14 일 jQuery-135,641 / prototype-2,327

jQuery는 매우 간결하고 간결한 코드입니다. 프로토 타입 기능에있어 많은 영역에서 종종 동등하지만 훨씬 더 장황합니다. 그러나 시작하는 데 도움이 필요하면 더 큰 커뮤니티가 필요합니다. 더 많은 지원, 이미 나와있는 동일한 질문에 대해 더 많은 답변을 제공하고 Google에 쉽게 접근 할 수 있으며, 더 많은 플러그인, 코드를 찾고있을 것입니다.

같은 이유로, 커뮤니티 규모가 클수록 코드가 많을수록 코드가 복잡해집니다 . 즉, 단순한 내용이 작성되었고 많은 복잡한 상황도 해결되었음을 의미합니다. 매우 풍부한 애플리케이션을 작성하는 경우 가능성이 있습니다. 꽤 복잡한 질문이나 상황에 직면하기 위해 ...이 문제를 처리하는 데 도움이되는 더 많은 리소스가 있습니다.

다시 말하지만 ... 동일한 커뮤니티 규모의 이유로 더 큰 커뮤니티가이를 면밀히 조사했기 때문에 프레임 워크에서 더 많은 결함이 발견되고 공백이 채워졌습니다. 이것은 당신이 문제를 발견했을 때 다른 누군가가했을 가능성이 있다는 것을 의미하며, 프레임 워크가 할 수없는 것을 쳤기 때문에 방해받지 않고 계속 움직이기 위해 어떤 방법이나 옵션이 추가되었습니다.


현재 Prototype에서 jQuery로 이동하기 위해 응용 프로그램에서 큰 블록을 다시 작성하고 있습니다. 왜? 플러그인, 플러그인, 플러그인, 특히 UI 위젯. 프로토 타입 UI 요소는 다소 단편적이고 단편적인 반면 jQuery에는 매우 풍부한 "표준"요소 집합이 있습니다.


JQuery는 페이지에 멋진 효과를 쉽게 추가 할 수 있도록 만들어졌습니다. 100 % 성공했습니다.

애니메이션과 가끔 Ajax 호출을 추가하는 것이 사람들이 일반적으로 Javascript 라이브러리에서 필요로하는 것이므로 JQuery에는 대규모 커뮤니티가 있습니다. JQuery의 모토는 "나는 약간의 반짝임을 추가하고 비켜 줄 것이다"이며, 이것이 바로 우리 개발자들에게 자주 필요한 것입니다.

그럼에도 불구하고 Prototype은 대부분의 다른 사용 사례에서 탁월합니다. 클래스 기반 OOP (생성자 상속과 같은 문제를 균일하게 해결)를위한 안정적인 프레임 워크와 데이터를 처리하기위한 일반적인 사용 추상화 집합이 있습니다.


Prototype보다 jQuery를 선택한 이유는 다음과 같습니다.

  • "더 많이하고 적게 쓰십시오 ..."
  • jQuery 커뮤니티가 더 큽니다 (따라서 더 많은 플러그인과 리소스)

나는 둘 다 사용했고 둘 다 좋아합니다. 프로젝트의 요구 사항에 따라 다릅니다. 나에게는 두 가지 요구 사항 때문에 두 플랫폼이 서로 다른 방향에서 나온 것 같습니다. 둘 다 웹 사이트 / 애플리케이션을 더 빠르고 더 잘 구축 할 수 있도록 프로그래밍 문제를 해결해야 할 필요성에서 만들어졌습니다.

표준 도구 상자를 사용하여 웹 사이트를 빠르게 만들 때 jquery와 그 라이브러리는 훌륭합니다. 바퀴를 재발 명하는 것은 의미가 없습니다. 그러나 내 도구 / 트릭이 작동하지 않을 때 이상한 브라우저 버전 문제가 발생하고 항상 해당 특정 버전을 가진 클라이언트가 발생합니다. 일반적으로 브라우저 버전이 출시 / 업데이트 될 때 발생합니다. 따라서 커뮤니티가 이미 해당 문제를 발견하고 해결 한 경우 모든 사이트를 업데이트하기 위해 해당 jquery 라이브러리 파일의 새 릴리스를 가져와야합니다. 내가 스스로 알아낼 시간이 없기 때문에 이것은 나의 유일한 오심입니다. 자주 발생하지는 않지만 발생합니다.

더 복잡한 웹 프로젝트, 아마도 백엔드 API로 지원되는 사이트 네트워크에서 작업 할 때 프로토 타입이 훌륭하다고 생각합니다. 저는 서버 측 OO 코딩을 최대한 활용했고 Prototype으로도 똑같이 할 수 있다는 사실에 매우 기뻤습니다. 내 응용 프로그램에 대해 더 많은 "통제력"을 갖고 있으며 작성자로서 신속하게 문제를 해결할 수있는 것 같습니다. 사람들이 오버 헤드, DOM 확장 등에 대해 말하는 것을 듣지만 주요 문제 (나무 노크)는 발생하지 않았습니다. 또한 .each (function () {}, ..)로 동일한 변수를 쉽게 반복하고 조금 더 제어 할 수있을 때 'for each'문이 없다는 전체 문제는 그다지 문제가되지 않습니다.

그래서 각각의 위치가 있고 당신은 자신의 약을 선택해야합니다.

처럼,


둘 다 "최고"도 아닙니다. 모두 다릅니다. 둘 다 시도하고 어떤 것이 더 좋아하는지 확인하십시오. 개인적으로 JQuery를 사용하는 이유 는 좀 더 발전된 프로토 타입보다 사용 하기 쉽고 학습 곡선이 길기 때문입니다.

보세요 :

프로토 타입 vs JQuery (Ajaxian에서)


이것은 jQuery와 MooTools에 대한 또 다른 흥미로운 기사입니다 (MooTools와 Prototype은 적어도이 토론의 맥락에서 대부분 상호 교환이 가능합니다) : http://jqueryvsmootools.com/


jQuery uses CSS-style selectors and filters which are based on CSS syntax. From a design standpoint, this has a lot of benefits. I'm very fond of and proficient at CSS, so jQuery feels right at home for me personally. If you are looking for a syntax so your all-around coding experience is more pleasant, and you're a big fan of/proficient at CSS, it's safe to say you will prefer jQuery over the alternatives. I took a basic course in Prototype and I was bored to tears. I've just completed "The Essentials of jQuery" over at Lynda's and I absolutely love it, because of it's close relationship with CSS. I've been programming in vanilla JavaScript for about 10 years and I have always found it to be extremely dry; and to me it's code overkill (not much bang for the buck). Though it's been very useful to me over the years. From what I've seen so far, jQuery is what JavaScript SHOULD HAVE been from day one. But then again, it takes a lot of time, testing, and effort to improve things. So jQuery wins for me.


I'm not experienced in jQuery or Prototype, yet. About to start learning one of them to add to my toolbox as a Senior ColdFusion Developer & project manager. My take on this is initially which one a new comer will decide on as this reflects industry adoptation, which IMHO is key.

Based on a quick look around and a few tutorial reads on both, it seems they each offer the same core abilities. However, looking at job boards and other projects, jQuery seems to be in much more "demand" as opposed to just a skill one can use. To me, jQuery wins here with adoption and demand, community support and documentation is a plus. Nothing against Prototype, it's good to know if a project requires it due to pre existence because some developer picked it as the first one he looked into.


i've used prototype framework and jquery , and as for me, i personally like jquery cuz of its noConflict(); i prefer to use the jq noConflict like this in my js files

(function($){

}(jQuery));

this manner will make you use the $ as you jquery selector per js file


Subscribing the already signed marked correct answer i wan't also to share a lib that allow you to use most of the utilities that you would expect to find on a framework like prototype but with the advantage of don't extend native objects. As consequence it provides you with more control and flexibility over complementary frameworks that you would like to use along your project.

Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects. It's the tie to go along with jQuery's tux, and Backbone.js's suspenders.


Could I also offer the argument that using one or the other is a bit of a false dilemma? Having lots of experience with jQuery I know how beneficial it can be and how much faster application development could become.

It's important to note, however, that it may perhaps be more beneficial for end users in some cases to use no library at all, especially in the instances where it's not required. While it's certainly helpful for large applications, it may be counter-intuitive for use on the common website on account of the impact to performance.

An extra HTTP request is made to download the library and, although usually small when minified, more bandwidth is required as a result. This has the potential of slowing down page load time which may be realized by mobile users.

Additionally, on load a library will immediately execute code to create globally-accessible functions and objects, thereby consuming more memory even if you never use them. Some libraries will also add functions and objects to built-in object prototypes, which also increases memory usage.

Finally, while jQuery and many other libraries are often extensively tested to ensure the least amount of impact to performance, the code you write, though reduced in quantity, will often be slower than otherwise. Keep in mind that everything you can do with a library you can do with raw JavaScript, since fundamentally they're the same.


Succinct concise code using abbreviate style operators tends towards being cryptic as well so it is not necessarily better. It can take away from the readability and make understanding what is going on less clear. In my many years of programming I have come across some very clever cryptic code that was the devil to figure out when it had problems. Personally I like code that self documents and that is optimized for the particulars of a situation. If your goal is to do the most in the least lines of code then using DOM extension libraries like prototype and jQuery may be for you. I personally think it is better to fully understand the capabilities of the JavaScript language itself and the DOM implementation of the browsers and leverage it for the task at hand, whether that be building UI widgets or whatever. I do use the script.aculo.us library on occasion for animation effects so I do find myself loading the prototype library code since scriptaculous depends on it. My suggestion for anyone using either of the libraries would be to learn how to write OO style JavaScript before completely depending on either of these libraries, then incorporate the one that seems to best fit your needs. Excellent book for learning OO style JavaScript is 'Java Design Patterns'.

참고URL : https://stackoverflow.com/questions/2644556/prototype-vs-jquery-strengths-and-weaknesses

반응형