문제

보석에서는"무엇 JS lib 당신이 사용하"조사

"@Xanti-yes,yes,모듈화하고 추상화에서 프로그래밍입니다 끔찍한 연습이다.함수를 호출하는 다른 기능은 무엇입니까?낭비입니다."

고 저는 호기심이기 때문에 나는 사용 Kohana framework for PHP and Jquery 라이브러리에 대한 자바 스크립트.

왜 일부 사람들이 고려한 추상화 및 모듈화 사례?되지 않은 프레임워크 및 라이브러리를 쉽게하기 위해 만들어지고 개발 속도?

링크 을 조사

도움이 되었습니까?

해결책

I have found that too much abstraction can be hazardous to your productivity:

  • A poorly chosen abstraction can be worse then no abstraction at all.

  • If you need to read four or five different modules in order to understand how a simple algorithm works, then the abstraction barriers are probably not in the right places. Maybe there's a good way to refactor the code, or maybe it would be easier just to remove the barriers.

  • If the abstraction does not correspond to a relatively familiar idea, it may be difficult for new team members to learn.

Abstraction is not a "mindless good"; it exists to serve specific purposes. Among the most common purposes are

  • To protect the invariants of a data structure

  • To encapsulate design decisions that are likely to change

My biggest experience with abstraction getting in the way was with our research compiler for C--. There was a great deal more abstraction than students were used to seeing in compiler class:

  • The target machine was abstract
  • The assembly language was abstract
  • The calling conventions were abstract
  • The stack-frame layout used an unusual "block" abstraction

Each of these abstractions served an important purpose for our research, but the total effect was that it was very difficult for new students to learn the compiler. So, even if the original comment was in jest, there are places where abstraction can cause problems.

다른 팁

Microsoft 자격있는 자선 단체에 대한 볼륨 라이선스 프로그램을 관리합니다.Microsoft Partner 또는 Microsoft 스스로를 이에 관해서는 안된다면, 그것은 내 첫 번째 중지가 될 것입니다.

http:///www.techsoup.org , 소프트웨어가 기부되고 적용 할 수 있습니다.거기.

관심있는 특정 추가 / 온 또는 서비스가있는 경우 해당 공급 업체와 직접 대화 상자를 열 것입니다.그들은 아마도 당신이나 당신이 그들의 기술을 사용하고있는 웹 사이트를 사용하는 것과 같은 몇 가지 양보로 깊은 할인을 할 수 있습니다.

We can probably assume the commenter was not being serious.

I can't imagine anyone claiming modularization and abstraction are bad practice and actually meaning it.

Abstraction and modularization in general are good and essential. There might be bad abstractions out there, e.g: frameworks which are not supported anymore or expensive or just not usable, or big, or outdated, or 2nd choice, et cetera. The library "market" in general is huge. Which kind of libraries you find yourself using depends on circumstance and personal preference.

Why do some people consider abstraction and modularization bad practices? Are not frameworks and libraries made to ease and speed up development?

Change and learning is sometimes hard - so people fight it. If you like to study this kind, you could start your research at: http://thedailywtf.com/ :-) I would just ignore them and use libraries and frameworks as they serve you and make your programmer life better.

A developer will claim that an abstraction or modularization is a bad practice when they are able or required to interact with said abstraction or modularization and are unable to understand its purpose or design.

When every function (and helper functions) is in its own module?

그것은 조용한 시간 전에만 설명서에 대한 fortran compiler 권장 선택한 식별자로서 문자열의 길이가 동일하며,무작위로 선택된 편지입니다.

설명?잘 할 수 있도 분포의 이름을 내부의 컴파일러는 해시 테이블과 이 때문에 제공한 빠르게 컴파일할 수도 있습니다.

내가 생각하는 텍스트가 당신을 인용 그리고 바로 옆이 추천

Good abstractions are used often

Good abstractions are referenced at 2 or more places in your software.

Examples:

  • Functions with 2+ call sites.
  • Abstract class with 2+ concrete classes.
  • Interfaces with 2+ implementations.
  • Generics with 2+ instantiations
  • Libraries with 2+ users.
  • etc.

An abstraction that's referenced at 2 or more places helps reducing the code size, by factoring out the common things, and this is a good thing.

But if you have a lot of abstractions that are referenced only a single time, then there is a good chance that the abstraction is not necessary.

Some examples when unnecessary abstractions come up:

  • Writing object happy code (interfaces and abstract classes everywhere having only 1 implementation or concretion). These interfaces and abstract classes are not necessary (at that point of development). YAGNI principle.
  • Someone builds a "shiny new" interface upon the old one, where the new functions after some conversion only call the old interface. You can imagine what a big mess is the result, if you repeat this several times. In this case the old functions will have a single call site, so they are not necessary. You need to move the code from the old functions into the new one or don't write a new one and modify the old one.

Some examples of really good abstractions:

  • Hardware abstraction layer: provides a single interface to applications so they don't need to develop code for each type of hardware.
  • File system: It doesn't matter you use FAT, NTFS, EXT3 whatever. It allows you to use files and directories, the file system driver does the rest.
  • C language: You don't need to port your program for each CPU architecture. Just compile it.

So to answer your question pragmatically: Abstractions are bad, when they are referenced from less than 2 places.

With regard to the modularization, its subjective: you can organize your code whatever you want. If your library's source code is in a single source file it doesn't make it worse than if you put explode it several hundreds of files.

When rating your abstractions as good or bad, always consider the big picture: the whole project, the whole product line, etc.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top