Where do we start?

User avatar
bo_knows
Site Admin
Posts: 660
Joined: Fri Jun 28, 2013 4:33 pm

Where do we start?

Postby bo_knows » Sat Dec 13, 2014 2:03 am

Here's a rough timeline of what we need to accomplish to get things moving:

- Create a basic set of stub data that would come from the form submission. (DONE)
- Create a basic iteration function that iterates through the Shiller Data set. (DONE)
- Create functions for inflation calculations, fee calculations, calculating the gain/loss of each asset type, etc.
- Add in functions that correctly add Extra Savings objects to the mix. (SS, Pensions, Savings)
- Add in functions that correctly add Extra Spending objects to the mix.
- Add in functions that cover ALL of the optional spending methods (this is a big amount of work).

Throughout this process, we need to keep in mind Unit Testing. I've never actually implemented unit testing. If anyone has suggestions on what we should use, I'm all ears. I've heard good things about Jasmine.

Also, one of the main changes I want to implement is how spending is calculated. cFIREsim (and FireCalc) both do their spending AND market gain calculations assuming it is December 31st. Folks have always complained about this. The reality is that most people would want to model taking their spending money out at the beginning of the year, and then watching the market gains. So, keep this all in mind.
-Bo (Creator and Admin for cFIREsim)

bogosj
Posts: 3
Joined: Thu Sep 04, 2014 12:23 am

Re: Where do we start?

Postby bogosj » Sun Dec 14, 2014 5:35 pm

What's a bit unclear to me is what the intent of the re-write is. From the looks of it there's still going to be PHP and MySQL involved? It looks like the data set is small enough that you could encode the entire dataset in JSON and include it in the page with the JS logic.

In theory the entire app could then be hosted off of github pages. The only caveat here is there would need to be a way for the user to save their simulations. Right now that's done by pushing the simulation config to your servers - with a pure JS implementation you could offer a method that "import/export"s the data as a JSON blob that users could save locally. Another option would be to do something like this: http://fargo.io/docs/fargo/dropbox.html

bogosj
Posts: 3
Joined: Thu Sep 04, 2014 12:23 am

Re: Where do we start?

Postby bogosj » Sun Dec 14, 2014 5:49 pm

I now see in the other thread in this board "move it away from PHP and into Javascript" - so I guess that answers one of my questions. A high-level design document for how the pieces would fit together would be great to review.

User avatar
bo_knows
Site Admin
Posts: 660
Joined: Fri Jun 28, 2013 4:33 pm

Re: Where do we start?

Postby bo_knows » Sun Dec 14, 2014 10:50 pm

bogosj wrote:What's a bit unclear to me is what the intent of the re-write is. From the looks of it there's still going to be PHP and MySQL involved? It looks like the data set is small enough that you could encode the entire dataset in JSON and include it in the page with the JS logic.

In theory the entire app could then be hosted off of github pages. The only caveat here is there would need to be a way for the user to save their simulations. Right now that's done by pushing the simulation config to your servers - with a pure JS implementation you could offer a method that "import/export"s the data as a JSON blob that users could save locally. Another option would be to do something like this: http://fargo.io/docs/fargo/dropbox.html


So, the main reasons for the rewrite are: clarity of code, adding unit tests, and involving the community for transparency. The original cFIREsim is NOT well organized (the code). A lot of people have clamored for transparancy in the code, so they can see whats going on. I also have been learning more Javascript in the past 6 months, and figured it would be a great project.

Yes, it will probably still use PHP. The dataset could feasibly be put inside a JSON object. I'm not entirely sure how big that'd be, but we can try it out. I also am not sure if users would prefer local storage of their saved simulations over being stored on a websites DB, but we can talk about that separately.
-Bo (Creator and Admin for cFIREsim)

mandark
Posts: 1
Joined: Sun Dec 14, 2014 9:07 pm

Re: Where do we start?

Postby mandark » Sun Dec 14, 2014 11:43 pm

A high-level design document for how the pieces would fit together would be great to review.


I completely agree with this comment. What's the design plan here? If it's "cobble together some Javascript and PHP", then a full rewrite seems like overkill - might as well just refactor your existing PHP code (moving some logic to Javascript if you really want) and make it open-source :)

User avatar
bo_knows
Site Admin
Posts: 660
Joined: Fri Jun 28, 2013 4:33 pm

Re: Where do we start?

Postby bo_knows » Mon Dec 15, 2014 2:03 am

mandark wrote:
A high-level design document for how the pieces would fit together would be great to review.


I completely agree with this comment. What's the design plan here? If it's "cobble together some Javascript and PHP", then a full rewrite seems like overkill - might as well just refactor your existing PHP code (moving some logic to Javascript if you really want) and make it open-source :)


Without busting out diagrams, the general workflow of cFIREsim is fairly simple.

Form Data --> submit --> for every cycle of X years, do the following: Calculate inflation, Calculate spending (based on spending method of choice), subtract spending from portfolio, calculate market gains based on portfolio (form input), add/subtract market gains, calculate/subtract fees, record all datapoints for the year.

Then, repeat for every possible cycle.

The most complicated parts of cFIREsim are the Spending Methods and the Input form itself... by far. Well, that and making sure that inflation factors into all of the numbers correctly. You wouldn't believe how many bugs crop up because inflation is overlooked or miscalculated.

As to whether it is overkill to redo or not? Maybe it is. But, the code is pretty hard to maintain... and I figured that there would be plenty of people that would love to help rework this project.

Maybe it's because I've never worked with a framework before, but I honestly think that using Angular for something like this is also overkill. There aren't a whole lot of complex data interactions going on here. Like someone said, you COULD probably just store the data locally as a JSON object.
-Bo (Creator and Admin for cFIREsim)

jeff
Posts: 22
Joined: Sun Nov 03, 2013 9:57 pm

Re: Where do we start?

Postby jeff » Mon Dec 15, 2014 3:42 pm

I'd add another vote for moving all of the data into JSON. The dataset is small enough to be handled entirely in JS and it will make setting up a development environment as simple as checking out the JS files.

For saving simulations, I would just store the submission data using HTML5 localstorage or using cookies. You've got (roughly) 4k to stash in a cookie, which is more than enough for all of the user inputs and you could break out each saved simulation into a separate cookie.

I can't comment on JS unit testing. I've used Selenium for testing some web apps I've built, but I think it would be cleaner and simpler to stick with a pure JS approach.
Last edited by jeff on Mon Dec 15, 2014 4:57 pm, edited 1 time in total.

jeff
Posts: 22
Joined: Sun Nov 03, 2013 9:57 pm

Re: Where do we start?

Postby jeff » Mon Dec 15, 2014 4:08 pm

I just noticed the sql file on the github repo. Without seeing the old code, it's hard to tell how all of that is used. The 'multipliers' table is obviously important, but are any of the other tables used during a simulation or are they just used to create the multipliers table?

User avatar
bo_knows
Site Admin
Posts: 660
Joined: Fri Jun 28, 2013 4:33 pm

Re: Where do we start?

Postby bo_knows » Mon Dec 15, 2014 5:14 pm

jeff wrote:I just noticed the sql file on the github repo. Without seeing the old code, it's hard to tell how all of that is used. The 'multipliers' table is obviously important, but are any of the other tables used during a simulation or are they just used to create the multipliers table?


The multipliers table is the main data set, broken up into 1 year increments. (The Shiller Data is monthly).
-Bo (Creator and Admin for cFIREsim)

britgamer
Posts: 7
Joined: Tue Dec 16, 2014 2:59 pm

Re: Where do we start?

Postby britgamer » Tue Dec 16, 2014 3:15 pm

I like the sound of all the data being in JSON. As well as simplifying the dev environment it may also allow the code base to be refactored into a library + a UI. That way it could be used as part of other projects.

Saving past simulations in cookies/localstorage also sounds like a neat solution. We may need to warn users of the limitations of saving this way so they don't think it's saved like the old site.

I do disagree about not using some kind of framework. I've seen forms far simpler than this become a mess without an MVVM library. Perhaps Angular is too heavy (but it was the quickest I have used to get 2 way binding to a form) but there are plenty of others out there


Return to “cFIREsim Open Source Project”

Who is online

Users browsing this forum: No registered users and 2 guests