I want to create solidity smart contract for MLM site like OXCash
Data structure which is suitable for the logic and or any other logic
Related
I have a class that I want to contain the logic for a specific requirement. The class currently requires 3 strings to construct. The string values need to be provided from runtime objects.
In the future the requirement to construct this class might extend to more data/elements.
Is this sort of class a good candidate for dot net core di or is this better suited for manual construction where needed?
Background: I'd like to leverage services I declare as part of a service collection in the construction of this class if necessary which is why I'm trying to make di work but am struggling to figure out how best to accomplish it because of all the stateful / evolving data elements it also requires.
I want to get informative data about the contract with using API.
I found hash address with using Etherscan. I copied the contract to the R. But I don't know how to get informative data (such as balance, token info etc.)
My screen look like this:
Smart contracts are written in Solidity programming language. Solidity programming language is not R programming language. You just cannot copy paste stuff from one language for another.
The correct answer is to run Ethereum node and use JSON-RPC API. But seems like your starting level of programming knowledge is too low for this, so recommend doing basic programming courses and learning before trying to try anything this complex.
I started Meteor a few months ago.
I would like to know if using cursor.observeChanges for buisness objects is a good idea
I want to separate operations and views so I can uses the same operations in many views/events, and I want to know if it is a good idea.
Someone told me, we should not separate operations on mongo from view.
So my question is : Is it a good idea to to Buisness Objects with Meteor ?
Tanks for reading me.
cursor.observeChanges is essentially what you get behind the scenes when you do normal find() queries and bind to template helpers due to its context being reactive.
In the meteor world, the traditional model/view/controller paradigm is shifted towards a reactive data-on-the-wire concept including features like latency compensation.
What you refer to as a business object is basically a representation of your business data which is strongly typed, has a type of its own, atomic, and has only one task of representing.
You can achieve that kind of separation of concerns in any language/framework, including meteor. That only depends on how you lay out, structure and abstract your code.
What Meteor brings into the equation is the toolset to build up an interface to your data with modern ux features that are otherwise very hard/expensive to get.
The only concern over business-class applications could be the fact that Meteor currently employs MongoDB by default. MongoDB has its own discussions around business applications whether they need transaction support, ad-hoc aggregation, foreign key relationships etc. But that is another topic.
I have a few quick questions about the use of the business logic layer in the average N-Tier architecture application.
I am developing my final year university project, and using a web forms presentation layer, business logic layer, data access layer and data layer.
1) What are your opinions on where is the best place to perform user input validation? To me it makes sense to use the presentation layer with something like jQuery validation for client side, and ASP.NET validation controls for server-side validation - however plenty of articles state it is best to perform validation in the BLL?
2) Currently my BLL is fairly thin, 90% of the classes simply act as an interface to the DAL, however I do know there will be more there eventually. In my DAL I have multiple select commands for each entity, e.g. GetAllProducts(), GetProductsByCategoryID(categoryID), GetProductByProductID(productID), GetProductsBySupplierID(supplierID). This appears to have a low level of business logic involved, i.e. technically there should simply be a GetAllProducts() function, which could be filtered using code in the BLL.
What is your opinion on the best practices for this? One select statement with filtering in the BLL, or as many select statements as needed to get the data I want? I would imagine always selecting every product would get pretty heavy on resources on large scale apps, however at least there is a true separation of logic between tiers.
Cheers,
Stu.
i don't think so you need to have bll. you just need to have two layers. WebUI and DAL.
and the use of linq to sql or lambda expression with Data entity model will be the perfect recipe.
One select statement with filtering in the BLL, or as many select statements as needed to get the data I want?
you should go for filtering in the bll as it is your final pro, if you need to use all the layers. it will so helpfull when u reuse your code. Do make filters in BLL.
Can you advice on structering the solution projects, files, fodlers in a way that it matches with the MVP design pattern in order to represent the pattern idea?
I mean how would you put your presenters, data acces layer, views etc.
Thanks
Solution architectures are generally pretty independent of which UI architecture you're using, although you might have some additional separation if you plan to have multiple UI applications (most projects don't).
I tend to start out with a template similar to this:
Acme.Sales or Acme.Sales.Core - internal domain/business logic
Acme.Sales.Entities - data entities used for persistence layers. Entities have similar class structure to the core (domain) model, but tend to have thinner logic, additional properties like Id, two-way relationships (as opposed to the one-way relationships in the domain model), and virtual members for the ORM to be able to override. This assembly will also normally include abstract repositories for CRUD operations on entities.
Acme.Sales.Entities.Impl where Impl is something like LinqToSql or NHibernate - this namespace defines one possible implementation for actually persisting the Entities. Concrete implementations of the abstract repositories go here.
Acme.Sales.UI contains common classes relating to any user interface - might be an MVP GUI or even a CLI. As with Entities, these are similar to the Core classes but tend to have presentation-specific logic and attributes, such as validation and formatting (which most often today is done through DataAnnotations). Note that the core library should also validate, but UI validation tends to be more about formatting and sanitization of inputs than business rules. It's tempting to mimic the domain's class structure here, but you'll have an easier time overall if you stick to flat, DTO-style classes for your UI model.
Acme.Sales.UI.Services contains abstract or concrete "service" types that are meant to interact with both the UI and the domain/persistence layers. Thus this project takes dependencies on Acme.Sales (domain), Acme.Sales.Entities (abstract repositories), as well as Acme.Sales.UI, and handles all of the mapping activities between those different layers.
Acme.Sales.UI.Impl where Impl here is something like Mvp, Mvc,Mvvm, and so on. You can drop the UI from this namespace if you want, as the implementation implies what it is. This generally takes a dependency on the UI project but adds those things specific to a particular UI model; controllers, presenters, view-models, etc. This is your actual "application". It's also where you normally choose an IoC container (AutoFac, Ninject, Spring.NET, Castle, Unity) and wire up all the specific implementations to the abstract types.
Within your application project you'd want to separate logical concepts into different sub-namespaces/folders. For example put your presenters in Presenters and views in Views - pretty straightforward - and create subdirectories in each of those if you start getting a really huge number of screens (e.g. Views.Billing and Views.Shipping). It's also OK to create top-level Area directories/namespaces here and put separate Presenters, Views, etc. in each one of those areas - this is the approach currently taken in ASP.NET MVC.
You don't need to separate Presenters and Views into different projects. Rest assured that the views which you tailor-made for MVP will be utterly useless for MVC or MVVM, and vice versa. The only part of a model-driven app that really stands a chance of being reused is the model itself.
Note that this is just a very basic architecture for an app with a single database and relatively simple domain logic. It doesn't include any higher-level back-end constructs like app integration (e.g. web services), eventing (pub/sub), batch processing, CQS, ad-hoc reporting, and so on and so forth. These tend to be pretty common in larger-scale business apps but if you're just starting out on a new social bookmarking app then you don't need any of that complexity.
Also note: This is all assuming you're planning at least a medium-size project - let's say one that you and/or your team will be working on for 6 months or more. If you plan to bang it all out in 1 month or less then please, don't waste your time on solution architectures at all. It's perfectly OK to just jam it all into one project and reuse the same classes for domain, entities, and UI - as long as the project is small enough to be easily understood and maintained. Carefully monitor the complexity and maintenance overhead and consider refactoring into the above structure over a longer period of time if the project starts turning into a ball of mud.
Below would be a nice start. You could split up even more if the project gets bigger:
Company.Project.Core -> Controller logic
Company.Project.Domain -> Domain models (view models and database models)
Company.Project.Interface -> Views, presenters