Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.preponderous.parpt.command;

import com.preponderous.parpt.config.PromptProperties;
import com.preponderous.parpt.domain.Project;
import com.preponderous.parpt.repo.ProjectRepository;
import com.preponderous.parpt.score.ScoreCalculator;
Expand All @@ -14,56 +15,20 @@ public class CreateProjectCommand {
private final ProjectService projectService;
private final ConsoleInputProvider inputProvider;
private final ScoreCalculator scoreCalculator;
private final PromptProperties promptProperties;

protected static final String PROJECT_NAME_PROMPT = "What is the name of the project? ";
protected static final String PROJECT_DESCRIPTION_PROMPT = "How would you describe the project? ";

// Impact prompts - focusing on benefits
protected static final String[] PROJECT_IMPACT_PROMPTS = {
"Will this make/save money? (1=tiny impact, 5=huge impact) ",
"Will this make users happier? (1=slightly, 5=dramatically) ",
"Will this give us an edge over competitors? (1=small edge, 5=game-changing) ",
"Will this solve any major problems? (1=minor issues, 5=critical problems) "
};

// Confidence prompts - how sure are we?
protected static final String[] PROJECT_CONFIDENCE_PROMPTS = {
"Do we understand what needs to be built? (1=very unclear, 5=crystal clear) ",
"Have we done something similar before? (1=never, 5=many times) ",
"Do we have the right skills in the team? (1=missing key skills, 5=perfect fit) ",
"Are the requirements likely to change? (1=constantly changing, 5=very stable) "
};

// Ease prompts - how simple is it?
protected static final String[] PROJECT_EASE_PROMPTS = {
"How straightforward is this to build? (1=very complex, 5=very simple) ",
"Do we have the tools we need? (1=need many new tools, 5=have everything) ",
"Can we reuse existing code/systems? (1=start from scratch, 5=mostly reusable) ",
"How easy is it to test? (1=very difficult, 5=very easy) "
};

// Reach prompts - who will it affect?
protected static final String[] PROJECT_REACH_PROMPTS = {
"How many users will this help? (1=very few, 5=almost all) ",
"Will this attract new users? (1=unlikely, 5=definitely) ",
"Will users notice this change? (1=barely noticeable, 5=very visible) ",
"How often will users benefit from this? (1=rarely, 5=daily) "
};

// Effort prompts - what will it take?
protected static final String[] PROJECT_EFFORT_PROMPTS = {
"How long will this take to build? (1=very quick, 5=very long) ",
"How many people need to be involved? (1=just a few people, 5=many teams) ",
"Will this be hard to maintain? (1=very easy, 5=very difficult) ",
"Does this need ongoing work? (1=set and forget, 5=lots of upkeep) "
};

public CreateProjectCommand(ProjectService projectService, ConsoleInputProvider inputProvider, ScoreCalculator scoreCalculator) {
public CreateProjectCommand(
ProjectService projectService,
ConsoleInputProvider inputProvider,
ScoreCalculator scoreCalculator,
PromptProperties promptProperties) {
this.projectService = projectService;
this.inputProvider = inputProvider;
this.scoreCalculator = scoreCalculator;
this.promptProperties = promptProperties;
}


private int getAverageScore(String[] prompts) throws InvalidScoreException {
int total = 0;
for (String prompt : prompts) {
Expand Down Expand Up @@ -93,16 +58,16 @@ public String execute(
) {
// Interactive input if parameters are not provided
if (projectName == null) {
projectName = inputProvider.readLine(PROJECT_NAME_PROMPT);
projectName = inputProvider.readLine(promptProperties.getProjectName());
}
if (projectDescription == null) {
projectDescription = inputProvider.readLine(PROJECT_DESCRIPTION_PROMPT);
projectDescription = inputProvider.readLine(promptProperties.getProjectDescription());
}
if (impact == null) {
boolean continueLoop = true;
while (continueLoop) {
try {
impact = getAverageScore(PROJECT_IMPACT_PROMPTS);
impact = getAverageScore(promptProperties.getImpact());
continueLoop = false;
} catch (InvalidScoreException e) {
System.out.println(e.getMessage());
Expand All @@ -113,7 +78,7 @@ public String execute(
boolean continueLoop = true;
while (continueLoop) {
try {
confidence = getAverageScore(PROJECT_CONFIDENCE_PROMPTS);
confidence = getAverageScore(promptProperties.getConfidence());
continueLoop = false;
} catch (InvalidScoreException e) {
System.out.println(e.getMessage());
Expand All @@ -124,7 +89,7 @@ public String execute(
boolean continueLoop = true;
while (continueLoop) {
try {
ease = getAverageScore(PROJECT_EASE_PROMPTS);
ease = getAverageScore(promptProperties.getEase());
continueLoop = false;
} catch (InvalidScoreException e) {
System.out.println(e.getMessage());
Expand All @@ -135,7 +100,7 @@ public String execute(
boolean continueLoop = true;
while (continueLoop) {
try {
reach = getAverageScore(PROJECT_REACH_PROMPTS);
reach = getAverageScore(promptProperties.getReach());
continueLoop = false;
} catch (InvalidScoreException e) {
System.out.println(e.getMessage());
Expand All @@ -146,7 +111,7 @@ public String execute(
boolean continueLoop = true;
while (continueLoop) {
try {
effort = getAverageScore(PROJECT_EFFORT_PROMPTS);
effort = getAverageScore(promptProperties.getEffort());
continueLoop = false;
} catch (InvalidScoreException e) {
System.out.println(e.getMessage());
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/preponderous/parpt/config/PromptProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.preponderous.parpt.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "parpt.prompts")
public class PromptProperties {
private String projectName;
private String projectDescription;
private String[] impact;
private String[] confidence;
private String[] ease;
private String[] reach;
private String[] effort;
}
29 changes: 29 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,32 @@ spring:
enabled: true
history:
enabled: true
parpt:
prompts:
project-name: "What is the name of the project? "
project-description: "How would you describe the project? "
impact:
- "Will this make/save money? (1=tiny impact, 5=huge impact) "
- "Will this make users happier? (1=slightly, 5=dramatically) "
- "Will this give us an edge over competitors? (1=small edge, 5=game-changing) "
- "Will this solve any major problems? (1=minor issues, 5=critical problems) "
confidence:
- "Do we understand what needs to be built? (1=very unclear, 5=crystal clear) "
- "Have we done something similar before? (1=never, 5=many times) "
- "Do we have the right skills in the team? (1=missing key skills, 5=perfect fit) "
- "Are the requirements likely to change? (1=constantly changing, 5=very stable) "
ease:
- "How straightforward is this to build? (1=very complex, 5=very simple) "
- "Do we have the tools we need? (1=need many new tools, 5=have everything) "
- "Can we reuse existing code/systems? (1=start from scratch, 5=mostly reusable) "
- "How easy is it to test? (1=very difficult, 5=very easy) "
reach:
- "How many users will this help? (1=very few, 5=almost all) "
- "Will this attract new users? (1=unlikely, 5=definitely) "
- "Will users notice this change? (1=barely noticeable, 5=very visible) "
- "How often will users benefit from this? (1=rarely, 5=daily) "
effort:
- "How long will this take to build? (1=very quick, 5=very long) "
- "How many people need to be involved? (1=just a few people, 5=many teams) "
- "Will this be hard to maintain? (1=very easy, 5=very difficult) "
- "Does this need ongoing work? (1=set and forget, 5=lots of upkeep) "
Loading