|
| 1 | +# Github Copilot Coding Challenge |
| 2 | +This is a playground project for testing out Github Copilot with Vaadin Flow. |
| 3 | + |
| 4 | +For more information you can refer to this Google Docs document: https://docs.google.com/document/d/1fgkVuvlDYJ6lN3bvQHjuhZK0hBu5rJHGao_bXMc5ISU/edit |
| 5 | + |
| 6 | +## Scoring (optional) |
| 7 | + |
| 8 | +In case you are up for it you can fill in the scorecard in the next section. This is purely for fun and to enhance the sense of accomplishment as part of the coding challenge. The main point of the challenge is to learn something new. If you accomplish this you are a winner 🙂 |
| 9 | + |
| 10 | +For solving a single challenge you get 1 point. You can also increase the points you get from a single solution using the following difficulty modifiers |
| 11 | + |
| 12 | + |
| 13 | +| Modifier | Points | |
| 14 | +|:-----------------------------------------------------------|:-------| |
| 15 | +| Use an IDE that you usually don’t normally use | x 1.5 | |
| 16 | +| Write the solution in a language you are not familiar with | x 2 | |
| 17 | +| Do the challenge another time in a different way | x 2 | |
| 18 | +| < Add your own modifiers here > | | |
| 19 | + |
| 20 | +## Scorecard (optional) |
| 21 | + |
| 22 | +| Challenge | Points | |
| 23 | +|:-----------------------------------------------------------|:-------| |
| 24 | +| Solve FizzBuzz 30 | | |
| 25 | +| Solve Bubble sort | | |
| 26 | +| Solve Fibonacci average | | |
| 27 | +| Generate enums from a text file | | |
| 28 | +| Generate translations for a new language | | |
| 29 | +| Migrate a class from Java to another language | | |
| 30 | +| Generate 100 person’s names | | |
| 31 | +| Write unit test cases for a previous algorithm | | |
| 32 | +| Write TestBench tests | | |
| 33 | +| Write TestBench unit tests | | |
| 34 | +| Refactor selection into a new method | | |
| 35 | +| Modernize Java code | | |
| 36 | +| Optimize BogoSort into something better | | |
| 37 | +| Optimize an algorithm | | |
| 38 | +| Ask Copilot to explain you a piece of code | | |
| 39 | +| Add JavaDocs | | |
| 40 | +| Find bugs in org.vaadin.challenges.bugs | | |
| 41 | +| Evaluate InsecureCodeExample for potential security issues | | |
| 42 | +| Implement Game of Life | | |
| 43 | +| Implement Tetris | | |
| 44 | +| < Add your own challenges here to keep going > | | |
| 45 | +| Total | | |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +# Project Base for Vaadin and Spring Boot |
| 50 | + |
| 51 | +This project can be used as a starting point to create your own Vaadin application with Spring Boot. |
| 52 | +It contains all the necessary configuration and some placeholder files to get you started. |
| 53 | + |
| 54 | +The best way to create your own project based on this starter is [start.vaadin.com](https://start.vaadin.com/) - you can get only the necessary parts and choose the package naming you want to use. |
| 55 | + |
| 56 | +## Running the Application |
| 57 | +There are two ways to run the application : using `mvn spring-boot:run` or by running the `Application` class directly from your IDE. |
| 58 | + |
| 59 | +You can use any IDE of your preference,but we suggest Eclipse or Intellij IDEA. |
| 60 | +Below are the configuration details to start the project using a `spring-boot:run` command. Both Eclipse and Intellij IDEA are covered. |
| 61 | + |
| 62 | +#### Eclipse |
| 63 | +- Right click on a project folder and select `Run As` --> `Maven build..` . After that a configuration window is opened. |
| 64 | +- In the window set the value of the **Goals** field to `spring-boot:run` |
| 65 | +- You can optionally select `Skip tests` checkbox |
| 66 | +- All the other settings can be left to default |
| 67 | + |
| 68 | +Once configurations are set clicking `Run` will start the application |
| 69 | + |
| 70 | +#### Intellij IDEA |
| 71 | +- On the right side of the window, select Maven --> Plugins--> `spring-boot` --> `spring-boot:run` goal |
| 72 | +- Optionally, you can disable tests by clicking on a `Skip Tests mode` blue button. |
| 73 | + |
| 74 | +Clicking on the green run button will start the application. |
| 75 | + |
| 76 | +After the application has started, you can view your it at http://localhost:8080/ in your browser. |
| 77 | + |
| 78 | + |
| 79 | +If you want to run the application locally in the production mode, use `spring-boot:run -Pproduction` command instead. |
| 80 | +### Running Integration Tests |
| 81 | + |
| 82 | +Integration tests are implemented using [Vaadin TestBench](https://vaadin.com/testbench). The tests take a few minutes to run and are therefore included in a separate Maven profile. We recommend running tests with a production build to minimize the chance of development time toolchains affecting test stability. To run the tests using Google Chrome, execute |
| 83 | + |
| 84 | +`mvn verify -Pit,production` |
| 85 | + |
| 86 | +and make sure you have a valid TestBench license installed. |
| 87 | + |
| 88 | +Profile `it` adds the following parameters to run integration tests: |
| 89 | +```sh |
| 90 | +-Dwebdriver.chrome.driver=path_to_driver |
| 91 | +-Dcom.vaadin.testbench.Parameters.runLocally=chrome |
| 92 | +``` |
| 93 | + |
| 94 | +If you would like to run a separate test make sure you have added these parameters to VM Options of JUnit run configuration |
| 95 | + |
| 96 | +### Live Reload (optional) |
| 97 | + |
| 98 | +With live reload, you can see the results of your code changes immediately. |
| 99 | +When you edit your Java code and recompile it, the application changes will be automatically reloaded and the browser is refreshed. |
| 100 | +This is done by leveraging [Spring Boot Developer Tools](https://docs.spring.io/spring-boot/docs/2.1.5.RELEASE/reference/html/using-boot-devtools.html). |
| 101 | +To be able to see the changes in the browser tab, the page still needs to be reloaded. |
| 102 | +That can also be automated via a LiveReload browser extension. |
| 103 | +One such extension for Google Chrome is [LiveReload](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei). |
| 104 | +In Firefox, [LiveReload - Web extension](https://addons.mozilla.org/en-US/firefox/addon/livereload-web-extension/) can be used. |
| 105 | +You can find such similar extensions for other major browsers too. |
| 106 | +These extensions add an icon to your browser next to the address bar. |
| 107 | +To enable the extension, you should click that icon after you opened your application. |
| 108 | + |
| 109 | +You can find more information at [Live Reload in Spring Boot Applications](https://vaadin.com/docs/flow/workflow/tutorial-spring-boot-live-reload.html) document. |
| 110 | + |
| 111 | +## Structure |
| 112 | + |
| 113 | +Vaadin web applications are full-stack and include both client-side and server-side code in the same project. |
| 114 | + |
| 115 | +| Directory | Description | |
| 116 | +| :--- | :--- | |
| 117 | +| `frontend/` | Client-side source directory | |
| 118 | +| `index.html` | HTML template | |
| 119 | +| `index.ts` | Frontend entrypoint | |
| 120 | +| `main-layout.ts` | Main layout Web Component (optional) | |
| 121 | +| `views/` | UI views Web Components (TypeScript / HTML) | |
| 122 | +| `styles/` | Styles directory (CSS) | |
| 123 | +| `src/main/java/<groupId>/` | Server-side source directory | |
| 124 | +| `Application.java` | Server entrypoint | |
| 125 | +| `AppShell.java` | application-shell configuration | |
| 126 | + |
| 127 | +## Useful links |
| 128 | + |
| 129 | +- Read the documentation at [vaadin.com/docs](https://vaadin.com/docs). |
| 130 | +- Follow the tutorials at [vaadin.com/tutorials](https://vaadin.com/tutorials). |
| 131 | +- Watch training videos and get certified at [vaadin.com/learn/training](https://vaadin.com/learn/training). |
| 132 | +- Create new projects at [start.vaadin.com](https://start.vaadin.com/). |
| 133 | +- Search UI components and their usage examples at [vaadin.com/components](https://vaadin.com/components). |
| 134 | +- View use case applications that demonstrate Vaadin capabilities at [vaadin.com/examples-and-demos](https://vaadin.com/examples-and-demos). |
| 135 | +- Discover Vaadin's set of CSS utility classes that enable building any UI without custom CSS in the [docs](https://vaadin.com/docs/latest/ds/foundation/utility-classes). |
| 136 | +- Find a collection of solutions to common use cases in [Vaadin Cookbook](https://cookbook.vaadin.com/). |
| 137 | +- Find Add-ons at [vaadin.com/directory](https://vaadin.com/directory). |
| 138 | +- Ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/vaadin) or join our [Discord channel](https://discord.gg/MYFq5RTbBn). |
| 139 | +- Report issues, create pull requests in [GitHub](https://github.com/vaadin/platform). |
0 commit comments