Catullus16
offline
offline
Catullus16
offline
offline
INTRACLASS SMELLS
-- complicated conditionals
-- duplicated code
-- large class
-- long method
-- magic numbers
-- switch statements
INTERCLASS SMELLS
-- comments
-- shotgun surgery
-- complicated conditionals
-- duplicated code
-- large class
-- long method
-- magic numbers
-- switch statements
INTERCLASS SMELLS
-- comments
-- shotgun surgery
Catullus16
offline
offline
magic numbers = using numbers in a method instead of a numerical constant var
duplicate code = including in other classes
long method = deep nesting, excess state parameters, duplicate logic, excess interclass coupling, overhead (syntactic noise), workability (screen size), multifunctional, http://stackoverflow.com/a/475762
complicated conditionals = duh
switch statements = basically same thing (especially when excess state parameters produce a "combinatorial explosion of execution paths")
large class = duh
shotgun surgery = touching one class means touching lots of others
comments = thick comments mean code itself isn't clear
duplicate code = including in other classes
long method = deep nesting, excess state parameters, duplicate logic, excess interclass coupling, overhead (syntactic noise), workability (screen size), multifunctional, http://stackoverflow.com/a/475762
complicated conditionals = duh
switch statements = basically same thing (especially when excess state parameters produce a "combinatorial explosion of execution paths")
large class = duh
shotgun surgery = touching one class means touching lots of others
comments = thick comments mean code itself isn't clear
Catullus16
offline
offline
long method
As a rule of thumb, if you feel the need to comment on something inside a method, you should take this code and put it in a new method.
extract => abstract
vars/params --> extract temp variables, replace param groups with objects, pass whole object?, replace method with method object?, decompose conditionals/loops
large class
extract, extract, extract
switch statements
replace type code with subclass/state/strategy
replace conditionals with polymorphism
replace parameters with explicit methods
introduce null object
comments
can we call this overcommenting or verbosity or something? there's nothing wrong with comments per se
extract, rename
replace assumptions with assertion checks
As a rule of thumb, if you feel the need to comment on something inside a method, you should take this code and put it in a new method.
extract => abstract
vars/params --> extract temp variables, replace param groups with objects, pass whole object?, replace method with method object?, decompose conditionals/loops
large class
extract, extract, extract
switch statements
replace type code with subclass/state/strategy
replace conditionals with polymorphism
replace parameters with explicit methods
introduce null object
comments
can we call this overcommenting or verbosity or something? there's nothing wrong with comments per se
extract, rename
replace assumptions with assertion checks
Catullus16
offline
offline
Your subclasses have constructors with code that is mostly identical --> Create a superclass constructor and move the code that is the same in the subclasses to it. Call the superclass constructor in the subclass constructors.
cohesion and coupling are orthogonal, etc.
cohesion and coupling are orthogonal, etc.
Catullus16
offline
offline
I - independent
N - negotiable
V - valuable
E - estimable
S - small
T - testable
affordance theory
nielsen's principles
patterns: observer/state/strategy
dependency inversion/injection
interface segregation/injection
N - negotiable
V - valuable
E - estimable
S - small
T - testable
affordance theory
nielsen's principles
patterns: observer/state/strategy
dependency inversion/injection
interface segregation/injection
Catullus16
offline
offline
switching to algebraic coding theory, even though it has nothing strictly to do with computer science.
hamming distance
(n,M) code
(n,M,d) code
(n,M,d)q code
in/complete NND
u-error-detecting iff d(C)>=u+1, so u=d-1
v-error-correcting iff d(C)>=2v+1, so v=u/2 (rounded down)
i-punctured code obtained by deleting the i-bit in every codeword
Aq(n,d) is the largest M s.t. there is an (n,M,d)q code
Aq(n,1)=q^n
Aq(n,n)=q
Aq(n+1,d+1)=<Aq(n,d)
A2(n+1,d+1)=A2(n,d) if d is odd
A2(n,2)=<2^(n-1)
singleton bound: M=<q^(n-d+1) so Aq(n,d)=<q^(n-d+1) and d=<n-logqM+1
hamming sphere-packing bound: Aq(n,2t+1)=<q^n/(sumt((nCm)(q-1)^m)) rounded down
hamming distance
(n,M) code
(n,M,d) code
(n,M,d)q code
in/complete NND
u-error-detecting iff d(C)>=u+1, so u=d-1
v-error-correcting iff d(C)>=2v+1, so v=u/2 (rounded down)
i-punctured code obtained by deleting the i-bit in every codeword
Aq(n,d) is the largest M s.t. there is an (n,M,d)q code
Aq(n,1)=q^n
Aq(n,n)=q
Aq(n+1,d+1)=<Aq(n,d)
A2(n+1,d+1)=A2(n,d) if d is odd
A2(n,2)=<2^(n-1)
singleton bound: M=<q^(n-d+1) so Aq(n,d)=<q^(n-d+1) and d=<n-logqM+1
hamming sphere-packing bound: Aq(n,2t+1)=<q^n/(sumt((nCm)(q-1)^m)) rounded down
Catullus16
offline
offline
gilbert-varshamov bound:
q^n=Aq(n,d)summ[0,d-1](nCm)(q-1)^m
probability of misdetection for (n,M,d)q u-detecting code where t=u+1 ---> sum[t,n] of (nCt)(p^t)q^(n-t)
same for miscorrection, with t=v+1
(nCt)(q-1)^t <-- number of words with hamming distance of exactly t<n
group axioms: closed under addition, associative, identity, inverse
abelian groups are also commutative
rigid motions of a square
subgroup = nonempty subset of a group
cosets: G is group, H is subgroup of G, a is member of G, coset of H in g is set of the form a+H={a+h}, h is a member of H, cosets of H are subsets of G
subgroups are always cosets (H=0+H) but cosets are not necessarily subgroups
lagrange's theorem:
cosets of H form a partition of G
union of all cosets of H is all of G
any pair of distinct cosets is dijoint
if H is finite, all cosets have same dimension |H|
if G is finite then each coset of H has size |G|/|H|
for nonabelians, distiguish left cosets from right cosets
for abelians, a+H=H+a
field axioms: closed under addition and multiplication, commutative, associative, distributive, additive and multiplicative identities, additive and multiplicative inverses
(F,+) is an abelian group
(F\{0},*) is an abelian group
* is distributive over +
rings are (R,+,*) but without multiplicative inverses of nonzero elements
commutative rings with identity
principal remainders
Zm is always a ring
Zm is a field iff m is prime
prime factorization
q^n=Aq(n,d)summ[0,d-1](nCm)(q-1)^m
probability of misdetection for (n,M,d)q u-detecting code where t=u+1 ---> sum[t,n] of (nCt)(p^t)q^(n-t)
same for miscorrection, with t=v+1
(nCt)(q-1)^t <-- number of words with hamming distance of exactly t<n
group axioms: closed under addition, associative, identity, inverse
abelian groups are also commutative
rigid motions of a square
subgroup = nonempty subset of a group
cosets: G is group, H is subgroup of G, a is member of G, coset of H in g is set of the form a+H={a+h}, h is a member of H, cosets of H are subsets of G
subgroups are always cosets (H=0+H) but cosets are not necessarily subgroups
lagrange's theorem:
cosets of H form a partition of G
union of all cosets of H is all of G
any pair of distinct cosets is dijoint
if H is finite, all cosets have same dimension |H|
if G is finite then each coset of H has size |G|/|H|
for nonabelians, distiguish left cosets from right cosets
for abelians, a+H=H+a
field axioms: closed under addition and multiplication, commutative, associative, distributive, additive and multiplicative identities, additive and multiplicative inverses
(F,+) is an abelian group
(F\{0},*) is an abelian group
* is distributive over +
rings are (R,+,*) but without multiplicative inverses of nonzero elements
commutative rings with identity
principal remainders
Zm is always a ring
Zm is a field iff m is prime
prime factorization
Catullus16
offline
offline
euclidian algorithm
bezout's identity
fermat's little theorem: k^n = k mod n
reed-solomon: [n,n-r,r+1]
dim=n-r, d=r+1
number of cosets for a k-dim linear code of length n over GF(q) is:
q^n/q^k = q^(n-k)
bezout's identity
fermat's little theorem: k^n = k mod n
reed-solomon: [n,n-r,r+1]
dim=n-r, d=r+1
number of cosets for a k-dim linear code of length n over GF(q) is:
q^n/q^k = q^(n-k)
You are not logged in. Please log in if you want to post a reply.






























