Каждый язык программирования имеет достоинства и недостатки. Вы должны знать отдельные достоинства и недостатки используемого языка. Определите конвенции программирования до начала программирования. Позднее адаптировать к ним код станет почти невозможно. Методик конструирования слишком много, чтобы использовать все в одном проекте. Тщательно выбирайте методики, наиболее подходящие для вашего проекта. Спросите себя, являются ли используемые вами методики программирования ответом на выбранный язык программирования или их выбор был определен языком. Помните, что программировать следует с использованием языка, а не на языке. Эффективность конкретных подходов и даже возможность их применения зависит от стадии развития соответствующей технологии.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Single Responsibility Principle | |
“…You had one job” — Loki to Skurge in Thor: Ragnarok | |
A class should have only one job. | |
If a class has more than one responsibility, it becomes coupled. | |
A change to one responsibility results to modification of the other responsibility. | |
""" | |
class Animal: | |
def __init__(self, name: str): |
People
:bowtie: |
😄 :smile: |
😆 :laughing: |
---|---|---|
😊 :blush: |
😃 :smiley: |
:relaxed: |
😏 :smirk: |
😍 :heart_eyes: |
😘 :kissing_heart: |
😚 :kissing_closed_eyes: |
😳 :flushed: |
😌 :relieved: |
😆 :satisfied: |
😁 :grin: |
😉 :wink: |
😜 :stuck_out_tongue_winking_eye: |
😝 :stuck_out_tongue_closed_eyes: |
😀 :grinning: |
😗 :kissing: |
😙 :kissing_smiling_eyes: |
😛 :stuck_out_tongue: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="table-responsive" style="max-width:400px"><table class="table table-hover table-bordered table-condensed table-list"> <tbody> <tr bgcolor="#FCF8F8" class="scrollable bordered"> <td height="33"><div align="left">AGE</div></td> <td>DEATH RATE<br> confirmed cases <br></td> <td>DEATH RATE<br> all cases</td> </tr> <tr class="scrollable bordered"> <td width="244"><div align="left"><strong>80+ years old </strong></div></td> <td width="125"><div align="right"><strong>21.9%</strong></div></td> <td width="125"><div align="right"><strong>14.8%</strong></div></td> </tr> <tr class="scrollable bordered"> <td><div align="left"><strong>70-79 years old </strong></div></td> <td><div align="right"></div></td> <td><div align="right"><strong>8.0%</strong></div></td> </tr> <tr class="scrollable bordered"> <td><div align="left"><strong>60-69 years old </strong></div></td> <td><div align="right"></div></td> <td><div align="right"><strong>3.6%</strong></div></td> </tr> <tr class="scrollable bordered"> <td><div align="left |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem | |
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. | |
For example, | |
Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6. | |
The below elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped. | |
defprotocol
: defines an interfacedeftype
: create a bare-bones object which implements a protocoldefrecord
: creates an immutable persistent map which implements a protocol
Typically you'll use defrecord
(or even a basic map
);
unless you need some specific Java inter-op,
where by you'll want to use deftype
instead.
Note:
defprotocol
allows you to add new abstractions in a clean way Rather than (like OOP) having polymorphism on the class itself,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1.Cannonballs | |
# | |
# A new kind of cannon is being tested. The cannon shoots cannonballs in a fixed direction. Each cannonball flies horizontally until it hits the ground, and then it rests there. Cannonballs are shot from different heights, so they hit the ground at different points. | |
# You are given two zero-indexed arrays, A and B, containing M and N integers respectively. Array A describes the landscape in the direction along which the cannon is shooting. Elements of array A represent the height of the ground, going from the cannon outwards. Array B contains levels from which consecutive cannonballs are shot. | |
# Assume that a cannonball is shot at level H. | |
# Let I be the smallest index, such that 0 < I < M and A[I] ≥ H. The cannonball falls at position I − 1 and increases the ground level A[I−1] by 1. | |
# If there is no such I, and H > A[I] for all 0 ≤ I < M, then the cannonball flies beyond the horizon and has no effect on the result. | |
# If H ≤ A[0], then the cannonball ricochets away and has no effect on the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/bin/jackd -P1 -dalsa -dhw:0 -r44100 -p1024 -n2 psuspender --jackd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Enter OpenSCAD code here. | |
module 200_balka(){ | |
translate ([0, 0, 10])cube([10, 10, 200]); | |
} | |
module 125_balka(){ | |
rotate([90, 0, 90]) cube([10, 10, 125]); | |
} | |
module 240_balka(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inner-pad.scad | |
//lad-cube.scad | |
module one-romb() { | |
scale ([1, 0.7, 1]) rotate ([45, 0, 0]) cube([30, 1, 1], center=true); | |
} | |
//lad-rombs.scad | |
module lad-rombs() { | |
for(i= [1 : 30]){ | |
translate ([0, i - (i * 0.3), 0]) one-romb(); |
NewerOlder