abvadabra / itmo-oop-tasks Goto Github PK
View Code? Open in Web Editor NEWImplementation of tasks from OOP course from second year at ITMO.
Implementation of tasks from OOP course from second year at ITMO.
There is a TrackGroup
class created but was not used, please implement ISearchable
interface for TaskGroup
s too, since it's a task requirement.
All fields of SearchQuery
class should be private.
Fields IncludeTracks, IncludeAlbums, IncludeArtists
may be converted to auto-properties,
Something like this:
public bool IncludeTracks { get; private set; }
Also, do not ignore your IDE hints:
There is another requirement in the task: Track must not be exists without album
, but I can break this logic if i'll call the following statements:
var genre = new Genre("Rock");
var artist = new Artist("My Band", genre);
var track = new Track(artist, null, "Track#01");
Catalog
's Artists field should not be public since it's an encapsulation rule violation.
Please review other classes for the same issues.
It would be awesome, if you can make Catalog
class static.
That would allow us to register all ISearchable
objects in the catalog right after initialization.
This can be simplified
https://github.com/FRedEnergy/itmo-oop-tasks/blob/462e8a0661c991c6d3c211409297273c06c6580b/Lab3/Program.cs#L13-L18
To:
if (!File.Exists(fileName)) {
Console.WriteLine(fileName + " not found");
return;
}
var dataFile = IniDataFile.Parse(fileName);
Accoring to MS naming conventions, methods should use UpperCamelCase
Please fix this:
https://github.com/FRedEnergy/itmo-oop-tasks/blob/462e8a0661c991c6d3c211409297273c06c6580b/Lab3/IniDataSection.cs#L19
p.s. And yet again, IDE should show suggestions like this:
Do not ignore them.
Please take care of culture of numbers with floating-point.
Please use explicit casting from double to string with a culture specification, like so:
var d = 3.123456789;
Console.WriteLine(d.ToString("F2", CultureInfo.InvariantCulture));
I would not advise you to implement string to anything
template method in this program.
Try to get rid of Convert.ChangeType
and replace it this specific calls for double and ints (i.e. double.TryParse and int.TryParse)
https://stackoverflow.com/questions/30819791/restrict-generic-t-to-specific-types
https://docs.microsoft.com/ru-ru/dotnet/csharp/programming-guide/types/casting-and-type-conversions
https://github.com/FRedEnergy/itmo-oop-tasks/blob/462e8a0661c991c6d3c211409297273c06c6580b/Lab3/IniDataFile.cs#L11-L15
Looks like a leak of verification that section do exists.
If you like syntax sugar, you can use Null coalescing operator:
// ...
get => Sections.GetValueOrDefault(key, null) ?? throw new SectionNotFoundException("...");
// ..
p.s. also, looks like we do not want to have a public setter.
Could you create more exceptions for specific cases?
IniFormatException
for formating errors is fine, but we need at least one for cast exceptions and one more for handling invalid structure of fine (i.e. SectionNotFound)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.