This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.concurrent.ThreadLocalRandom; | |
| import java.util.concurrent.atomic.LongAdder; | |
| import java.util.stream.Collectors; | |
| import org.openjdk.jmh.annotations.Benchmark; | |
| import org.openjdk.jmh.annotations.BenchmarkMode; | |
| import org.openjdk.jmh.annotations.Fork; | |
| import org.openjdk.jmh.annotations.Measurement; | |
| import org.openjdk.jmh.annotations.Mode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use crate::util::util; | |
| use std::vec::Vec; | |
| pub fn execute() { | |
| let filename = String::from("day1.txt"); | |
| let masses: Vec<u32> = util::read_file(filename); | |
| println!("Part one answer: {}", part_one(&masses)); | |
| println!("Part two answer: {}", part_two(&masses)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.IOException; | |
| import java.nio.charset.StandardCharsets; | |
| import java.nio.file.Files; | |
| import java.nio.file.Paths; | |
| import java.security.MessageDigest; | |
| import java.security.NoSuchAlgorithmException; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.stream.Collectors; | |
| import java.util.stream.Stream; |
Full talk: https://www.youtube.com/watch?v=QiaDztJZO5Q
Make a prioritised list of your current technical debt. Allocate time to tackle it and keep that list in mind when you are working on something new. Think about whether what you are writing will end up on that list.
Cohesion is where code does one thing really, really well. Code that is more cohesive changes less, and reduces effort to make any needed changes to it. One measure of cohesion is Cyclomatic complexity and services like www.sonarcloud.io can analyse this for you.