9,660 reputation
2348
bio website dmitry.cheryasov.in
location
age
visits member for 3 years, 11 months
seen 3 hours ago

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

google profile


Sep
16
comment Dealing with browser cache in single-page apps
+1 to using a version number or a timestamp as a URL parameter for resources.
Sep
10
comment Simple unicode application?
(1) Take a look at Anki. (2) On desktop, consider writing a local Web application. It's much easier on the client side, and not harder on the server side. Listen on localhost, auto-launch a browser, and you're done with Unicode issues, font issues, styling, controls, etc.
Sep
9
comment Architecture to handle service concurrency on resources exposed via REST API
How much do you want the optimistic locking mechanism that entity tags provide? It looks like this mechanism is not very complex; you could roll your own if you don't want to depend on the framework. How important is for you to be able to use different languages or different framework versions?
Sep
8
comment Ambiguous If-else nested block in C without braces
The C compiler totally ignores indentation. It associates the else with the closest if. Either brace every branch (highly recommended), or keep one-line branches on the same line as if and else keywords.
Aug
28
comment Is it a good practice to declare instance variables as None in a class in Python?
@Davidmh: A detected error is always better than an undetected error, indeed! I'd say that if you have to make an attribute None and this value does not make sense at the moment of the instance construction, you have a problem in your architecture and have to rethink the life cycle of the attribute's value or its initial value. Note that by defining your attributes early you can detect such problem even before you wrote the rest of the class, let alone running the code.
Aug
28
comment Is it a good practice to declare instance variables as None in a class in Python?
Well, method resolution order in Python (also applicable to data members) is not very simple. What is not found on instance level, will be searched for on class level, then among base classes, etc. You can indeed shadow a class-level member (data or method) by assigning a same-named instance-level member. But instance-level methods are bound to instance's self and don't need self to be passed, while class-level methods are unbound and are plain functions as seen at def time, and accept an instance as first argument. So these are different things.
Aug
27
revised Is it a good practice to declare instance variables as None in a class in Python?
edited body
Aug
27
revised Is it a good practice to declare instance variables as None in a class in Python?
added 2 characters in body
Aug
27
answered Is it a good practice to declare instance variables as None in a class in Python?
Aug
13
comment Property-level value transformation for indirect object casting
You can achieve this using reflection and probably annotations to express the mapping. I wonder why would you need this, instead of having your class explicitly implement an interface that helps return a property object you're asking for (I suspect that a Map<String, String>?)
Aug
9
comment How to route messages between clients using a central server in Python
You can indeed use Flask or web.py, or even Python's built-in SocketServer. But you only need this if you want to learn firsthand how to write a [makeshift] message-passing service. If you want to do something interesting with messages, take a ready-made framework like RabbitMQ, ZeroMQ, etc (see answers).
Aug
8
reviewed Reject suggested edit on Should a domain object wrap/contain a DTO interface?
Aug
8
reviewed Approve suggested edit on How to make sure media are used only on authorised sites?
Aug
8
reviewed Approve suggested edit on Why should I prefer composition over inheritance?
Aug
6
comment Learning but then forgetting
Keywords to google: "spaced repetition", "Anki". Make you a deck of C-related questions, or find a shared one; practice.
Aug
5
reviewed Approve suggested edit on Should you ever use private on fields and methods in C#?
Jul
29
comment Good practice for returns in Python
A tuple is a perfectly good object with two attributes. But once you find yourself wondering what is where in your tuple, it's probably time to make the parts named instead of indexed. Often namedtuple suffices.
Jul
18
comment Difference between Yesod and Ocsigen web frameworks
See also stackoverflow.com/a/5650715/223424
Jul
18
comment Object Design & Cohesion - Issue & potential refactoring
@GetFuzzy: I think exposing other interfaces' methods is a LoD violation, but exposing methods that return these interfaces, without meddling with the innards of their implementation, is its reverse. Maybe my answer was not clear enough. I proposed to have a WellFluids GetFluids() method that returns an (immutable view of) some private WellFuids well_fluids = SomeWellFuidsImpl(), following your ReferenceWellData design.
Jul
18
comment Object Design & Cohesion - Issue & potential refactoring
I wonder why do you use "proxy functions from each class to glue it all back together". Why don't you do something like RefWellData.GetFluids().AtDepth(100) or RefWellData.GetTemperatures().AtSurface()? To me, this looks like a simple composition exercise; is there something that makes such an approach inconvenient?