Giter Site home page Giter Site logo

cslajs's People

Contributors

jasonbock avatar mikemccaughan avatar rockfordlhotka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cslajs's Issues

Create rules

We need a way to define rules and incorporate them into the BO lifecycle. That is:

  • Allow the dev to add them via something like addBusinessRules()
  • Call them at the correct times during a BO lifecycle (e.g. DP operation, property change, etc.)

We may be able to handle this with functions, or create a OO rule design similar to what's in .NET

Implement metastate and property management

We need a way to track when properties change so we'll know when to fire rules and change metastate on a BO (e.g. isSavable, isDirty, isNew, etc.)

One whiteboard approach:

public class Stuff : BusinessBase {
public get x(): int {
return this.getProperty("x");
}

public set x(val: int) {
this.setProperty("x", val);
}
}

Where getP/setP would be defined on the base class. Unfortunately all TS/JS supports is the notion of public and private, so these methods would have to be public for the subclass to call them.

It may be possible to take advantage of JS's dynamic nature to only add properties to a private collection if the developer has called the getP/setP. This would allow the dev to not have to define a private backing field and let CSLA handle that. A problem may be if the property doesn't have a defined backing field yet, so what would "return this.getProperty("x");" do for an int? Even with generics in TypeScript we probably won't have enough information at runtime to synthesize the property correctly. So we may end up with this:

public class Stuff : BusinessBase {
private _x: int;

public get x(): int {
return this.getProperty("x", "_x");
}

public set x(val: int) {
this.setProperty("x", "_x", val);
}
}

For this issue, only define the metastate properties and change them with setProperty(). Rules (business + authorization) will be addressed later (so no broken rules collection as of yet).

Determine promise library to use

A fair amount of DP operations need to be asynchronous. Using promises is what we should use - we need to figure out the best approach here (i.e. use a library to support this, create our own that's compliant, etc.)

JS Implementation + Test Structure

I took a look at the csla.js file and it had tests and a bunch of stuff into it. Yet there is also a test project. I like what a lot of projects are doing and that is placing a .spec.js file right next to the file that contains the tests. This tests right next to the file and the tooling can pick it up via a wild card. Also, It's kind of hard to track what's transpiled and what isn't when viewing the source.

Add configuration to DataPortal

Create a configuration object (+ interface) that will be passed to a DataPortal instance to determine how things will work, like:

  • Should serialization be used (this is an optimization in .NET, we may not need this)
  • Which proxy to use (local or server)
  • Which URL to hit for a server-based DP operation (would only be used for server proxy)

Create node instance to support server-side DataPortal

Define a node implementation that will respond to DP operations, process them appropriately, and return values back as needed. Note that we may follow the convention in CSLA.NET to have one "get" operation for every DP call and differentiate each based on parameters (e.g. create, fetch, insert, update, delete, execute)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.