Tag Info

Hot answers tagged

5

I don't think you should have syntax highlighting information directly in your text buffer. Instead, I would add additional data structures for the display code. Here's why: Once you're providing functionality like selections etc, you'll probably need an anchor concept (a steady pointer to a specific location in the buffer, even when characters are ...


2

In the business layer you simply don't honor any update even if it does come from the UI. I guess you could also do this in the data layer but that does not mean skip it in the business layer. For that matter you could also enforce it a the database with for example triggers. In the business layer you expose a flag / property of IsEditable (or some other ...


2

Those two things do not much have in common, except the fact that also in the Service Layer pattern some kind of "events" may be involved. But that is where commonalities end. in the "Service Layer pattern", there are different layers calling each other and triggering some system change. But the calls are not necessarily "captured in event objects", nor ...


2

Consider two options. Validate everything on the server, at all times. Suppose you pay for 2 extra weeks of developer time (e.g. $10k), and e.g. $100/mo extra for more computing power. Nothing interesting happens. Do not validate input and save the money and time. Then someone mischievous steals a secret, finds out that the server side allows to do ...


2

I'd say no, its not. The reason is that anyone can sniff the network traffic to see what your calls are, and if you're not validating, you're opening up security risks as well as data corruption risks. The performance rationalization doesn't hold water; are there performance issues on the client running the rules? If not, then there should not be ...


2

I fully support pushing authorization checks down as low as they can go! And in doing so, you're not prohibited from writing automated authorization tests against every layer "above" it -- which I'd encourage if it soothes a paranoid feeling, allows you to enforce more strict rules at the service layer (CanView/CanSerialize?), or introduces edge cases like ...


1

To complete Doc's response, events are not meant to return values, this would be a violation of the CQS pattern (separation of commands and queries, aka read/write). They capture business intentions, creating a kind of audit trail for all that happen in the system. They can be the only data source in the system. In that case, there may be no need to have a ...


1

Your approach is far different from that of most PHP applications does, obviously a template engine binds some logic in views, most programmers prefer writing this logic in PHP itself. Limiting PHP to create services/ API s to only manipulate Data is a good idea, indeed. You may consider http://backbonejs.org/. I believe you could use it to write all ...


1

It really depends on the context in which you want to invoke those functions. [A] assumes that the arguments of your method are always well known in the section of code you wish to invoke it. You should use a static method for these types of stateless calculations. [B] assumes that the arguments/state of the code is different depending on some other ...


1

Yes, the service layer is an overhead if you don't have any business logic there. Layered architecture looks like an overhead when a layer (in your case service) is not doing much. But a layered architecture provides your loose coupling which is generally good for adapting requirements in future. If you can guarantee that you will never need to do anything ...


1

It looks like you want to spool the result of HTTP requests. Indeed, you might use some caching HTTP proxy like squid (you might use it, instead of coding your own). You could use both HTTP client libraries (like libcurl) and HTTP server libraries (like libonion) in the same process (but probably in different threads, or thru some event loop like libev or ...


1

Your code is much too complicated for such a simple requirement. This is because you are focusing on the representation (four hex characters) when you should be focusing on the thing represented, which is merely a two-byte integer. A C# ushort is precisely that type. For convenience, you could create a struct (not a class) that contains a short and methods ...


1

The second approach seems more clean, however if I need a new length for the ids I would have to make a new class AND replace the instance of the old class everywhere it is used You already gave the two striking arguments why this is exact the opposite of beeing clean. So you should avoid specific derivations for specific lengths. However, you wrote ...


1

tl;dr Your decisions on how much to abstract should be dependent upon your business problem to choose how much of the baby to split. Understanding relationships and how to define them properly without creating 'god' objects is a common problem when architecting solutions. Your idea on compromise is spot on when you are trying to accomplish something and ...



Only top voted, non community-wiki answers of a minimum length are eligible