10,541 reputation
2453
bio website dmitry.cheryasov.in
location
age
visits member for 4 years, 3 months
seen 2 hours ago

I constantly try to expand the little I know about programming.

google profile


Apr
15
comment TDD Red-Green-Refactor and if/how to test methods that become private
You don't need to change the access level of a method. What I'm trying to say is that you have an intermediate access level which allows to write certain code, including tests, easier, without making a public contract. Of course you have to test the public interface, but additionally it's sometimes beneficial to test some of the inner workings in isolation.
Apr
15
answered TDD Red-Green-Refactor and if/how to test methods that become private
Apr
14
answered should I help QA team in finding bugs?
Apr
13
comment Ant colony algorithm
If I were building an ant colony, I'd have two types of pheromone marks: "regular", always left where an ant travels, and "food", only left by an ant carrying food. An ant moves towards greater concentration of "regular" pheromone if it's carrying food, otherwise towards "food" marks. Also I'd make ants "hungry" and "sated"; a hungry ant travels towards "food" marks but away from "regular" marks, in order to search for new food sources. (I'd also make the grid hexagonal, but it's not the point.)
Apr
12
answered “One of some”-type
Apr
12
comment Given a tree calculating Max Sum from top to bottom suing DFS? optimization?
Your code just traverses each path in the tree. This is expected to be expensive (DFS is "P-complete"). If your tree had any interesting properties, e.g. if it were a B-tree, the calculation could be made fast.
Apr
12
comment Using subroutines to return values?
@Snowman: Fortran is alive and kicking in numerical-heavy areas. If you wonder what powers the nice hip things like numpy and scipy, it's partially old pal Fortran. OTOH it's reasonable to learn Fortran 90/95, not Fortran IV. I believe Fortran 90 allows you to pass / return parameters in more sophisticated ways.
Apr
8
comment Recursively parse without resorting to ugly design patterns
I'd also give JParsec a try. To me thinking in parser combinators is easier.
Apr
5
revised User sessions in a web server; speed or persistence?
deleted 4 characters in body
Apr
4
answered User sessions in a web server; speed or persistence?
Apr
1
revised Avoid opt(options) in javascript
added 10 characters in body
Mar
31
answered Avoid opt(options) in javascript
Mar
29
comment Pattern matching against two similar types
You need to specify the "we don't care" situation in more detail. You know, much of the code marked 'this should never happen' sometimes executes.
Mar
28
comment Why using string[] args in all main methods?
@Craig: I'm aware of the NT heritage; inside, Windows is a much nicer OS that one might think looking at the various 'surface-level' APIs. But this applies to the kernel architecture, not (so much) the userland. Obviously, MS had to support the previous convention of invoking things like foo /h that people were used to.
Mar
20
comment What is the preferred way to approach this problem in object-oriented design? - virtual disks abstraction
I'd take #2 for its clearer separation of concerns. If you happen to add another kind of storage (e.g. an EBS volume), you'll have easier time implementing it, without touching every disk type. Basically you need a pair (type of disk, storage location) with certain limitations on what types can be paired. Try thinking about this, too.
Mar
20
reviewed No Action Needed How can I avoid these nested repetitive ifs?
Mar
20
reviewed No Action Needed Python, namespace vs module with underscores
Mar
20
awarded  Curious
Mar
15
comment closure property of datatype “tuple” in python
@overexchange If an element of DList can be another DList, this will form a recursive data structure. If e.g. an element of DList can be a SList, and an element of SList can be a DList, this would be a mutually recursive data structure. If an element of type T cannot be a part of another element of type T, then T is not a recursive type.
Mar
14
comment closure property of datatype “tuple” in python
Something that has parts is not atomic. A struct of more than one field, or a tuple of more than one (or maybe more than zero) elements is non-atomic. A tuple that has another tuple as an element is definitely not atomic (that is, composite).