background preloader

Coding Principles

Facebook Twitter

How to lose weight (in the browser) Is there a built-in login template in django.

Java

Separation of concerns. The value of separation of concerns is simplifying development and maintenance of computer programs.

Separation of concerns

When concerns are well-separated, individual sections can be reused, as well as developed and updated independently. Of special value is the ability to later improve or modify one section of code without having to know the details of other sections, and without having to make corresponding changes to those sections. Implementation[edit] Separation of concerns is an important design principle in many other areas as well, such as urban planning, architecture and information design.[5] The goal is to more effectively understand, design, and manage complex interdependent systems, so that functions can be reused, optimized independently of other functions, and insulated from the potential failure of other functions. Origin[edit] The term separation of concerns was probably coined by Edsger W. Let me try to explain to you, what to my taste is characteristic for all intelligent thinking.

GRASP (object-oriented design) General Responsibility Assignment Software Patterns (or Principles), abbreviated GRASP, consists of guidelines for assigning responsibility to classes and objects in object-oriented design.

GRASP (object-oriented design)

Larman states that "the critical design tool for software development is a mind well educated in design principles. It is not the UML or any other technology. " Thus, GRASP is really a mental toolset, a learning aid to help in the design of object-oriented software. The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event.

A use case controller should be used to deal with all system events of a use case, and may be used for more than one use case (for instance, for use cases Create User and Delete User, one can have a single UserController, instead of two separate use case controllers). SOLID (object-oriented design) In computer programming, SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Michael Feathers for the "first five principles" named by Robert C.

SOLID (object-oriented design)

Martin[1][2] in the early 2000s[3] that stands for five basic principles of object-oriented programming and design. The principles when applied together intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time.[3] The principles of SOLID are guidelines that can be applied while working on software to remove code smells by causing the programmer to refactor the software's source code until it is both legible and extensible.

It is part of an overall strategy of agile and adaptive programming.[3] You ain't gonna need it. "You aren't gonna need it"[1][2] (acronym: YAGNI)[3] is a principle of extreme programming (XP) that states a programmer should not add functionality until deemed necessary.[4] Ron Jeffries writes, "Always implement things when you actually need them, never when you just foresee that you need them.

You ain't gonna need it

"[5] The phrase also appears altered as, "You aren't going to need it"[6][7] or sometimes phrased as, "You ain't gonna need it". YAGNI is a principle behind the XP practice of "do the simplest thing that could possibly work" (DTSTTCPW).[2][3] It is meant to be used in combination with several other practices, such as continuous refactoring, continuous automated unit testing and continuous integration. Used without continuous refactoring, it could lead to messy code and massive rework. Continuous refactoring in turn relies on automated unit tests and/or static analysis tools as a safety net and continuous integration to prevent wider integration problems.

Don't repeat yourself. Applying DRY[edit] DRY vs WET solutions[edit]

Don't repeat yourself

KISS principle. Design principle preferring simplicity Origin[edit] While popular usage has transcribed it for decades as "Keep it simple, stupid", Johnson transcribed it as "Keep it simple stupid" (no comma), and this reading is still used by many authors.[7] The principle is best exemplified by the story of Johnson handing a team of design engineers a handful of tools, with the challenge that the jet aircraft they were designing must be repairable by an average mechanic in the field under combat conditions with only these tools.

KISS principle

Hence, the "stupid" refers to the relationship between the way things break and the sophistication available to repair them. The acronym has been used by many in the U.S. military, especially the U.S. Variants[edit] A variant – "Make everything as simple as possible, but not simpler" – is attributed to Albert Einstein, although this may be an editor's paraphrase of a lecture he gave.[8]