Hot answers tagged

13

Building a web application is absolutely more complicated and harder to build than client-server, for a given set of features. There are a variety of reasons and ideas I'll describe in no particular order. The highest voted question of all time on this site is What technical details should a programmer of a web application consider before making the site ...


7

No, not necessarily. What you need to understand is that the Web architecture is a Client-Server architecture, it's just that the Client here is provided for you (the browser). The real question is, does the browser meet your requirements? Can it perform all the operations you want of the Client? If so, it may well be easier to re-use that existing Client. ...


6

(...), would it be good practice to use negative numbers to define error conditions? Providing error messages and valid return values using the same channel is rarely a good idea. See how on a typical *nix standard input, output and error are separate - try to mirror that in your application. If your language of choice provides constructs dedicated to ...


6

It's often language dependant. Quite common practice in languages such as C and C++, but where other mechanisms exist it's preferable to use them, for example exceptions. They allow decoupling - both conceptual and in code - of usage of the method result from dealing with errors. int result = myFunction(); if (result < 0) dealWithError(result); else ...


5

If they were asking for the architecture of some code or files, they might be asking about what classes there are and how they interact. However, in a project, we group classes into larger components, and these components interact. Given that they're asking about the project, they're asking for the big picture of top level components and their ...


5

Technically, you are free to design the layers in your architecture however you want, but keep in mind transactions express some kind of business logic. If you put business logic into the UI, you make it much harder to write automatic tests for it, since you restrict yourself to tests you can create with an UI testing tool. This typically means ...


5

"I think it would add a level of complexity to the app" ... opposed to what - using just one schema for all tenants? Then typically the opposite is true. Implementing multi-tenancy in one schema adds the complexity to each and every table where the data might belong to different tenants, which means this kind of complexity will go also into your app. ...


4

This is the approach which is used by many web applications. Should you do it? It depends. The full-AJAX approach has its drawbacks: SEO. For an interactive application which handles user content, such as GMail or Slack, or any other content which is not text, images or video, such as Google Maps, this is a non-issue: there is nothing to index. For ...


4

The way to tell is to write the two-function version without the default argument and see if that makes your code any cleaner. We work in software. It costs practically nothing to try changes like that, and I guarantee people whose code you admire do it all the time. If the default argument was appropriate, then your rewritten split off function will do ...


3

Modifying a variable on one thread and reading it on another is always problematic. Modifying it on two threads is worse. You can use atomic variables. An atomic variable would for example guarantee that readers get important_var = 0, then important_var = 5.0, then important_var = 10.0 and so on. If important_var is not atomic, reading it just when it is ...


3

In my experience it doesn't have to be more expensive to write a web application. We recently did some research to decide what approach to use for our own future projects. From developing a lot of windows applications we decided to move to web applications instead. In my opinion there are a few big advantages for using a web application. Often more easy ...


3

Your business logic should remain untouched. The Rest API is a view. The UI is a view. At most the controller should change to accommodate this change. In an ideal design the controller would have no knowledge of any views and wouldn't change at all. Rather than showing the flow of information it would have been helpful to see the directions of ...


2

A multitenant architecture has the benefit of scalability as well as security. When you have all the client data in one table, all customers has access to all customer data, not calculating the code you write to restrict this access. In a multitenant architecture you can set up different users in the db and have a much simpler design of the authentication ...


2

You should use the generic type parameter in this case. Using an empty protocol will be almost equivalent to using Any (unlike Any, types would have to be manually extended to conform to Type). Once you put something into Class, you would be losing its type information, just like if you had used Any. That type information could be useful, don't throw it ...


2

Overloading the meaning of any encoding is a dangerous thing. Here a message code means both: success / failure Id's the specific message Here is how that double meaning will evolve: Future programmers will curse the API when they realize that they must send a message in order to just say "success." Future future programmers will curse the design ...


2

Its not so much that globals make code harder to debug - though if you have a very large program and global state that is defined a long way from where its used, that can have an adverse effect. The problem with global state is that its global, singular, difficult to extend. Think of this, you have some variables that you want to modify in your functions, ...


2

I think this depends on whether (A) your structure is small enough to easily fit in memory, and (B) whether you need to support lots of different parts being edited at once by different people. With that in mind, I think the simplest solution is to treat the relation-web as a single big unit (an "aggregate root"). It is responsible for recording ...


2

Database systems can implement very different approaches. Just compare SQL vs. NoSQL. And for the latter compare key-value stores with graph databases. So you'll not find a silver bullet that will offer a single API with all the benefits of these databases. So you'll have to narrow down your scope. Considering the limits, filtering, ordering, many of ...


2

(1) Self-describing variable and function names help at the function level, i.e. writing: data_with_chars_cleaned = clean_character_data(...) makes it unnecessary to add a comment # returns .... Keeping functions small makes it easier to come up with a descriptive name. (2) Good abstractions make it unnecessary to keep all the minutiae in your head. ...


2

I think this is a prime example of when IoC containers can be useful. You can create different configurations for each customer that decides how your factories are initialized, what strategies are injected, what classes you use for what interfaces and so on. This, together with an all-around pluginish design lets you vary functionality in subtle ways in a ...


2

The question is not independend from the concrete project and what technical abilities you have to ensure modularity. In terms of patterns, this is a classical Strategy Pattern together with Inversion of Control. You have to abstract away every concrete functionality and factor it out to the module. Say you were doing a software to calculate taxes. In a ...


2

The external microservices are exactly that: external. You should consider them as a dependency with which you interact through HTTP and which shouldn't be trusted. The fact that it shouldn't be trusted creates a first set of difficulties. Even if you have a well-specified interface, you shouldn't assume that the other side will obey to it. It might start ...


1

I think the core of your problem is insufficient decomposition of your "modules". You need to split them to a fine-enough grained model that you can find more reuse. If Customer A, which I will call Cust1 wants something in Module B, which I will call Mod1 that is different than Customer C, which I will call Cust2 wants, then you probably want to extract ...


1

You have to take into account also: Security, you need in any case protect your application against any threat and in this regard Web-based apps have the disadvantage because they are exposed to the Internet which is and will never be a secure place. It is important to specify the security features required for the system and if you are going to use a cloud ...


1

No - web development is very competitive with native app development. Overall architecture: Most modern fat client applications communicate with middleware, rather than directly to the database. With .Net the middleware is typically a SOAP web service. Many modern web applications are single page applications. In this architecture, a JavaScript client ...


1

I do this when I dont always need to change the argument. When something is 90% of the time the same it becomes handy to have an default parameter. In a way it's a kind of overriding. Example: I have a method that gets data and has a bunch of filter arguments. It's possible that not every filter parameter is benig used when the user wants to get some ...


1

In my understanding, primary function of a bounded context is to encapsulate a common language used by a group of users. This is the main tool that enables reflecting already used terminology in software abstractions instead of creating unnatural abstractions to satisfy all users. IMO primary guideline for drawing context boundaries would be to not think ...


1

"Bounded context should be relatively small, but large enough only to capture the complete ubiquitous language of the isolated business domain, and no larger"


1

A bounded context contains a domain model. So typically, a bounded context represents an application or micro/service. A large application such as an ERP suite, could have multiple bounded contexts representing the different applications in the suite, e.g. CRM, Accounting, Procurement, HR. If modifying part of an existing application, it can be common to ...


1

Your Business Layer is the place where the encryption should happen. Repositories should only concern with data retrieval and storage.



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