Skip to content

Commit e6c1457

Browse files
authored
standardize starter code across all language projects (#381)
- Use consistent greet(name) function pattern across all languages - Apply language-specific naming conventions (camelCase, PascalCase, snake_case) - Rename Python py_check folder to app (more conventional) - Rename C# Example files to Greeting for consistency - Fix JavaScript best practices (remove console.log, add describe block) - Ensure all projects return "Hello, World!" format consistently
1 parent e85ff51 commit e6c1457

File tree

21 files changed

+86
-96
lines changed

21 files changed

+86
-96
lines changed

c-sharp/Application/Example.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

c-sharp/Application/Greeting.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Application;
2+
3+
public class Greeter
4+
{
5+
public string Greet(string name)
6+
{
7+
return $"Hello, {name}!";
8+
}
9+
}

c-sharp/Application/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-

2-
Console.WriteLine("Hello, World!");
1+
using Application;
2+
3+
Console.WriteLine(new Greeter().Greet("World"));

c-sharp/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ init:
44
verify:
55
dotnet test
66

7-
.PHONY: init verify
7+
run:
8+
dotnet run --project Application
9+
10+
.PHONY: init verify run

c-sharp/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
# C# Technical Interview
22

3-
We're excited to pair with you on a coding kata!
3+
We're excited to pair with you on a coding kata!
44

55
You will use this solution to write your code and tests to solve the problem of the kata below. We will gradually add requirements as we move through the problem and get a feel of what it's like to work with you in a real-world situation. Take your time, explain your thinking, and have fun with us! Show off your skills and ask any questions you have and we'll do the same.
66

7+
## Tech Stack
8+
- .NET with C#
9+
- xUnit
10+
11+
## Common Commands
12+
- `make init`
13+
- build the project
14+
- `make verify`
15+
- run tests
16+
- `make run`
17+
- run the application
18+
719
## Kata
820

921
This section of the README is used to describe the kata and outline the requirements. We'll leave it blank in the public repository to keep the mystery alive, but just know that the kata we have planned is really fun!

c-sharp/UnitTests/ExampleTests.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

c-sharp/UnitTests/GreetingTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace UnitTests;
2+
3+
using Application;
4+
5+
public class GreetingTests
6+
{
7+
[Fact]
8+
public void GreetReturnsFormattedMessage()
9+
{
10+
Greeter greeter = new();
11+
12+
var result = greeter.Greet("World");
13+
14+
Assert.Equal("Hello, World!", result);
15+
}
16+
}

go/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ package main
22

33
import "fmt"
44

5-
func SayHello(name string) string {
6-
return fmt.Sprintf("Hello %s", name)
5+
func Greet(name string) string {
6+
return fmt.Sprintf("Hello, %s!", name)
77
}
88

9-
109
func main() {
11-
fmt.Println(SayHello("world!"))
10+
fmt.Println(Greet("World"))
1211
}

go/main_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ package main
22

33
import (
44
"testing"
5-
65
"github.com/stretchr/testify/assert"
76
)
87

9-
func TestSayHello(t *testing.T) {
10-
result := SayHello("world!")
11-
assert.Equal(t, "Hello world!", result)
8+
func TestGreet(t *testing.T) {
9+
result := Greet("World")
10+
assert.Equal(t, "Hello, World!", result)
1211
}

java/src/main/java/com/sourceallies/interview/Solution.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class Solution {
44

5-
public String getGreeting() {
6-
return "Hello, world!";
5+
public String greet(String name) {
6+
return "Hello, " + name + "!";
77
}
88
}

0 commit comments

Comments
 (0)