INDAPlus21 / INDAPlus21/eliased-palinda
Pass
- Dominant language
- Go
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
**Very well done Elias!**
### Palinda 1
_Golang slice memory management is pure stupidness! #rant_
```go
func fibonacci() func() int {
seq := []int{0, 1}
return func() int {
//...
seq = //...
//...
}
}
func main() {
f := fibonacci()
for i := 0; i < 10; i++ {
fmt.Println(f())
}
}
```
Java standards are not expected with Golang. The language documentation however is contradictive. They support simplistic short naming, but preach readable code which present intent. I have a hard time with interpretation.
```go
// i'm not following the java test standards in go!
func TestOdd(t *testing.T) {/*...*/}
// i'm not following the java test standards in go!
func TestBig(t *testing.T) {/*...*/}
```
### Palinda 2
#### Debugging Concurrent Programs
Your answers are acceptable, but could be more detailed.
#### Many Senders; Many Receivers
_Instructions_:
> Describe what happens, and explain why it happens, if you make the
following changes in the program. Try first to reason your way
through, and then test your hypothesis by changing and running the
program.
Your answers are acceptable, but lack hypothesises.
#### Pythia, the Oracle of Delphi
_My console_:
```
PS C:\[...]\eliased-palinda\palinda-2\oracle> go run
go run: no go files listed
PS C:\[...]\eliased-palinda\palinda-2\oracle> go run oracle.go
Welcome to Pythia, the oracle at Delphi.
Your questions will be answered in due time.
> The one with the power to vanquish the Dark Lord approaches... Born to those who have thrice defied him, born as the seventh month dies... and the Dark Lord will mark him as his equal, but he will have power the Dark Lord knows not... and either must die at the hand of the other for neither can live while the other survives... The one with the power to vanquish the Dark Lord will be born as the seventh month dies...
It will happen tonight. The Dark Lord lies alone and friendless, abandoned by his followers. His servant has been chained these twelve years. Tonight, before
midnight... the servant will break free and set out to rejoin his master. The Dark Lord will rise again with his servant's aid, greater and more terrible than ever he was. Tonight... before midnight... the servant... will set out... to rejoin... his master...
SlowIt will happen tonight. The Dark Lord lies alone and friendless, abandoned by his followers. His servant has been chained these twelve years. Tonight, before midnight... the servant will break free and set out to rejoin his master. The Dark Lord will rise again with his servant's aid, greater and more terrible
than ever he was. Tonight... before midnight... the servant... will set out... to rejoin... his master...
down!
Pythia heard: Slow down!
> in prophecy
down!... down! indeed...
It will happen tonight. The Dark Lord lies alone and friendless, abandoned by his followers. His servant has been chained these twelve years. Tonight, before
midnight... the servant will break free and set out to rejoin his master. The Dark Lord will rise again with his servant's aid, greater and more terrible than ever he was. Tonight... before midnight... the servant... will set out... to rejoin... his master...
omg...
Pythia heard: omg...
> in prophecy
omg...... omg... indeed...
The one with the power to vanquish the Dark Lord approaches... Born to those who have thrice defied him, born as the seventh month dies... and the Dark Lord will mark him as his equal, but he will have power the Dark Lord knows not... and either must die at the hand of the other for neither can live while the other survives... The one with the power to vanquish the Dark Lord will be born as the seventh month dies...
It will happen tonight. The Dark Lord lies alone and friendless, abandoned by his followers. His servant has been chained these twelve years. Tonight, before
midnight... the servant will break free and set out to rejoin his master. The Dark Lord will rise again with his servant's aid, greater and more terrible than ever he was. Tonight... before midnight... the servant... will set out... to rejoin... his master...
You are The Grim, my dear, the Grim!’ cried Professor Trelawney, who looked shocked that Harry hadn’t understood. ‘The giant, spectral dog that haunts churchyards! My dear boy, it is an omen – the worst omen – of death!
rambling
Pythia heard: You are rambling
> in prophecy
rambling... rambling indeed...
The one with the power to vanquish the Dark Lord approaches... Born to those who have thrice defied him, born as the seventh month dies... and the Dark Lord will mark him as his equal, but he will have power the Dark Lord knows not... and either must die at the hand of the other for neither can live while the other survives... The one with the power to vanquish the Dark Lord will be born as the seventh month dies...
```
Your code would benefit of a cleanup. First, take credit. Two, keep commentary consistency. Three, no out-commented code. Four, remove spagetti comments.
_Your code_:
```go
// Stefan Nilsson 2013-03-13
//...
func Oracle() chan<- string {
//...
// receive all questions
go func() {
for question := range questions {
// fmt.Println("received", question)
go prophecy(question, answers)
// RandomSleep(100) // Simulate time to consume data.
}
}()
go func() {
//...
}()
go func() {
//...
}()
// TODO: Answer questions.
// TODO: Make prophecies.
// TODO: Print answers.
//...
}
// ...
func prophecy(question string, answer chan<- string) {
//...
answer <- (longestWord + "... " + longestWord + " indeed...") // + nonsense[rand.Intn(len(nonsense))]
}
//...
```
### Palinda 3
#### Matching Behaviour
Nice monolog. This course, _DD1396 Parallel Programming in Introduction to Computer Science_, doesn't feature parallelism. Gorutines are mainly concurrent, sometimes executed in parallel on different cores. They are implemented as tasks and are scheduled on OS-threads. Thus process partitioning might, in certain contexts, not be effective. Every process in Go is carried by goroutines; the main function is running on the main goroutine. Goroutines also don't have to be run directly after creation, but are queued in wait for an execution window. Therefore, programmers cannot be sure that gorutine results are produced in a foreseen manner.
#### MapReduce
Your computer must be slow. I got with your solution: 1147 ms vs. 885 ms.
Keep it up!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with oracle.go and the Oracle and prophecy entry points shown in the report. Review the concurrent-programming explanations and the surrounding comments, then run `go run oracle.go` to compare the current behavior with the examples. Done means the requested cleanup and consistency issues have been addressed, but the report does not define a narrower scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100