Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make code more readable #41

Open
3 tasks
FreePhoenix888 opened this issue Apr 7, 2022 · 3 comments
Open
3 tasks

Make code more readable #41

FreePhoenix888 opened this issue Apr 7, 2022 · 3 comments
Labels
C# good first issue Good for newcomers help wanted Extra attention is needed

Comments

@FreePhoenix888
Copy link
Member

  • Move these lines to separate function SetMarkers
    var markerIndex = One;
    MeaningRoot = links.GetOrCreate(markerIndex, markerIndex);
    var unicodeSymbolMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    var unicodeSequenceMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    DocumentMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    ObjectMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    MemberMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    ValueMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    StringMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    EmptyStringMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    NumberMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    NegativeNumberMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    ArrayMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    EmptyArrayMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    TrueMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    FalseMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
    NullMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
  • Move to separate function SetMatchers
    TargetMatcher<TLinkAddress> unicodeSymbolCriterionMatcher = new(Links, unicodeSymbolMarker);
    TargetMatcher<TLinkAddress> unicodeSequenceCriterionMatcher = new(Links, unicodeSequenceMarker);
  • Move to separate function SetConverters
    UnicodeSequenceToStringConverter = new CachingConverterDecorator<TLinkAddress, string>(
    new UnicodeSequenceToStringConverter<TLinkAddress>(Links, unicodeSequenceCriterionMatcher, sequenceWalker,
    unicodeSymbolToCharConverter));
    BigIntegerToRawNumberSequenceConverter =
    new(links, AddressToNumberConverter, ListToSequenceConverter, NegativeNumberMarker);
    RawNumberSequenceToBigIntegerConverter = new(links, NumberToAddressConverter, NegativeNumberMarker);
    DecimalToRationalConverter = new(links, BigIntegerToRawNumberSequenceConverter);
    RationalToDecimalConverter = new(links, RawNumberSequenceToBigIntegerConverter);

    Note: I have not highlighted all lines you should move. For example there are move converter assign expressions (but in constructor like these) that you must move
    put the part of DefaultJsonStorage constructor where markers are assigned to separate function SetMarkers. Reason: They are not placed close together
@FreePhoenix888 FreePhoenix888 added good first issue Good for newcomers help wanted Extra attention is needed C# labels Apr 7, 2022
@Ali-Kabbadj
Copy link

hello ,
i would like to work on this issue.
Some variables are read-only or have only a get assessor , i was wondering if maybe they should have a 'private set' assessor instead .
Thanks in advance.

@Konard
Copy link
Member

Konard commented Apr 11, 2022

@Ali-Kabbadj it would be nice to have a chat about the issue in our official Discord server.

@Ali-Kabbadj
Copy link

@Konard for sure !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants