Giter Club home page Giter Club logo

weatherterminal's Introduction

WeatherTerminal

Console application for getting weather data

This application takes weather data from https://openweathermap.org (provides information for every 3 hours) and presents it in different ways, which user can choose by typing commands

The architecture is built using 3 patterns:

  • MVC (WeatherCoomection + Controller + Console + Application)
  • Singleton (WeatherConnection, Controller),
  • Command (All classes from package "command", interface Command)

The application runs in console and allows user to execute commands:

  • -cw -- get current weather
  • -tw -- weather till the end of this day
  • -cdw -- choose a day to get its weather at 12 p.m. (not farther than 5 days from current date)
  • -fdf -- get five day forecast (for 12 p.m. each day)
  • -help -- get list of commands
  • -city -- change city
  • -ex -- exit

weatherterminal's People

Contributors

merrymike-noname avatar

Watchers

 avatar

weatherterminal's Issues

Code review

  1. Hardcodem magic numbers: and here
    for (int i = startIndex; i < controller.getLogLength(); i += 8) {
    and a few more places
  2. Adding separate class for single error message is certainly java way: https://github.com/merrymike-noname/WeatherTerminal/blob/main/WeatherTerminal/src/main/java/org/coursework/kovalenko/command/HelpCommand.java on the other hand build string is such imperative way not an option too:
    threeHourInfo.append("\n- Date & time: ").append(content.get(timeIndex).get("dt_txt")).append("\n");
    threeHourInfo.append("- Temperature: ").append(mainData.get("temp")).append("\n");
    threeHourInfo.append("- Feels like: ").append(mainData.get("feels_like")).append("\n");
    threeHourInfo.append("- Wind speed: ").append(windData.get("speed")).append("\n");
    threeHourInfo.append("- Weather: ").append(weatherData.get("main"))
    .append(" (").append(weatherData.get("description")).append(")");
    it will be better to have something like resource-file JSON or XML, or even MD/TXT format
  3. Complex expression in while condition, I'd prefer intermediate variables
    while(i < content.size() && !content.get(i).get("dt_txt").toString().matches("\\d{4}-\\d{2}-" + day + " 12:00:00")){
  4. You need linker for auto check/fix code alignment, spaces, line split, etc.

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.