Skip to content

LoadStock reads from file, then parses the data and swallows all exceptions #9

@rakitaj

Description

@rakitaj

I think LoadStock can be improved by either splitting it apart into multiple methods or by moving some of the logic into the Stock class.

First it reads the file where the data is stored, I think that's ok. Then it parses the text in that file into a format for the Stock constructor. The issue is the format for saving a stock is defined in the Stock.ToString() override.

For an easy first step, the code for parsing the text file into units (separated by ',') and then parsing it into values for the Stock constructor can be extracted into a method or two.

The code for parsing/creating a Stock could also live in the Stock class, since it controls part of its own serialization format.

Lastly catching all exceptions and doing nothing with them is always something to look at for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions