Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Classes to stub files #500

Closed
gypsydave5 opened this issue Sep 10, 2021 · 9 comments · Fixed by #501
Closed

add Classes to stub files #500

gypsydave5 opened this issue Sep 10, 2021 · 9 comments · Fixed by #501

Comments

@gypsydave5
Copy link
Contributor

Given #478 added stubs solution files to all of the exercises, which then breaks the fetching of exercises in Pharo (see #499), and also given the discussion on #478, we need to put classes inside these stubs.

Just opening this issue to give a place to start attacking and discussing the problem.


As we'll have to do this for all of the current exercises, and all future exercises, it seems like it would make the most sense if it was (at least eventually) automated.

I'm going to propose a script that could generate the right class based on the test files. Not sure if this would be more easily done in Pharo or something else.

@gypsydave5
Copy link
Contributor Author

I'm not too familiar with exercism development or Pharo, but is the only way of doing this editing each of the stub files outside of Pharo?

@ghost
Copy link

ghost commented Sep 10, 2021

I also not , I see that the files are in the exercises directory but do not know how we can change them.

And I thought about it, when we want to add the stub files , we have a lot of work to do for the current and for the challenges we added just because some one decided that tracks needs to have a stub file.

Is it then not fair that the person who made the problems, also solve them.
is now a lot of work for them but in the future not.

and for the test-runner, that is needed if we want to use the online ide , which I think never will happen for pharo because we cannot give them then the full pharo experience (TDD) , let the debugger make classes and methods and so on

my 2 cts now I have thought about it

@gypsydave5
Copy link
Contributor Author

gypsydave5 commented Sep 10, 2021

Is it then not fair that the person who made the problems, also solve them. is now a lot of work for them but in the future not.

I think that ship has sailed, nobody was keeping up with the changes for v3 of Exercism, or feeding back that this might be an issue. We are, as they say, where we are.

Reading #478 (comment) more carefully, I thing I prefer @Bajger's (b) idea of getting Pharo to just ignore the stub file on fetch. I at least understand how that would work, and it would be lasting fix.

let the debugger make classes and methods and so on

I agree with @RoelofWobben that at least having the option of generating the classes from the debugger when running the tests would be more idiomatic to Pharo development (or at least to how I've been doing it the last two months - what do I know?!)

@ghost
Copy link

ghost commented Sep 10, 2021

@bajgers have give me some code to ingnore the stub files when there are empty but that gave some more problems further in the chain. so maybe he knows a way to get around that

@Bajger
Copy link
Contributor

Bajger commented Sep 10, 2021

@gypsydave5 Well, to ignore a empty file did chain of other problems (as Roelof reported). I think creating stub files with empty class definitions isn't so much complicated. We can generate them programatically, then export them to .st files that will be put to dedicated directory of local repo (clone of dev baseline).

gypsydave5 added a commit to gypsydave5/pharo-smalltalk that referenced this issue Sep 10, 2021
…sm#500

- necessitated a decoupling of the files from the valid files; the iterator now only uses the content dict for both filenames and contents
@gypsydave5
Copy link
Contributor Author

I've made a commit to my fork that looks like it works by ignoring any empty (nil content) file:

gypsydave5@80bccdd

I've tested it manually by fetching and submitting grains - all OK.

The unit tests have one failure, but I believe it to be unrelated.

@Bajger
Copy link
Contributor

Bajger commented Sep 10, 2021

Following code should give class .st files. I still can try to ignore empty file:

#('Exercise@Acronym' 'Exercise@Allergies' 'Exercise@Anagram' 'Exercise@ArmstrongNumbers' 'Exercise@AtbashCipher' 'Exercise@Binary' 'Exercise@Bowling' 'Exercise@Clock' 'Exercise@CollatzConjecture' 'Exercise@Darts' 'Exercise@Diamond' 'Exercise@Die' 'Exercise@Etl' 'Exercise@FlattenArray' 'Exercise@Forth' 'Exercise@GradeSchool' 'Exercise@Grains' 'Exercise@Hamming' 'Exercise@HelloWorld' 'Exercise@HighScores' 'Exercise@IsbnVerifier' 'Exercise@Isogram' 'Exercise@Leap' 'Exercise@Luhn' 'Exercise@MatchingBrackets' 'Exercise@Matrix' 'Exercise@Minesweeper' 'Exercise@Pangram' 'Exercise@Proverb' 'Exercise@Raindrops' 'Exercise@ResistorColorDuo' 'Exercise@ReverseString' 'Exercise@RobotSimulator' 'Exercise@RomanNumerals' 'Exercise@SecretHandshake' 'Exercise@Sieve' 'Exercise@SpaceAge' 'Exercise@SumOfMultiples' 'Exercise@Tournament' 'Exercise@TwelveDays' 'Exercise@TwoFer' 'Exercise@Welcome' 'Exercise@WordCount') do: [:packageName | 
	|className execlass|
	className := (packageName splitOn: $@) last asSymbol.
	execlass := Object subclass: className
	instanceVariableNames: ''
	classVariableNames: ''
	package: packageName.
	execlass fileOut.
]

@gypsydave5
Copy link
Contributor Author

chain of other problems

What were they? I'd be interested as I've not hit anything (other than the weird coupling of data in the ExercismSubmission but that didn't take too much to fix).

@gypsydave5
Copy link
Contributor Author

Following code should give class .st files. I still can try to ignore empty file:

#('Exercise@Acronym' 'Exercise@Allergies' 'Exercise@Anagram' 'Exercise@ArmstrongNumbers' 'Exercise@AtbashCipher' 'Exercise@Binary' 'Exercise@Bowling' 'Exercise@Clock' 'Exercise@CollatzConjecture' 'Exercise@Darts' 'Exercise@Diamond' 'Exercise@Die' 'Exercise@Etl' 'Exercise@FlattenArray' 'Exercise@Forth' 'Exercise@GradeSchool' 'Exercise@Grains' 'Exercise@Hamming' 'Exercise@HelloWorld' 'Exercise@HighScores' 'Exercise@IsbnVerifier' 'Exercise@Isogram' 'Exercise@Leap' 'Exercise@Luhn' 'Exercise@MatchingBrackets' 'Exercise@Matrix' 'Exercise@Minesweeper' 'Exercise@Pangram' 'Exercise@Proverb' 'Exercise@Raindrops' 'Exercise@ResistorColorDuo' 'Exercise@ReverseString' 'Exercise@RobotSimulator' 'Exercise@RomanNumerals' 'Exercise@SecretHandshake' 'Exercise@Sieve' 'Exercise@SpaceAge' 'Exercise@SumOfMultiples' 'Exercise@Tournament' 'Exercise@TwelveDays' 'Exercise@TwoFer' 'Exercise@Welcome' 'Exercise@WordCount') do: [:packageName | 
	|className execlass|
	className := (packageName splitOn: $@) last asSymbol.
	execlass := Object subclass: className
	instanceVariableNames: ''
	classVariableNames: ''
	package: packageName.
	execlass fileOut.
]

wow this is cool - going to have to give it a few more reads to understand it.

ErikSchierboom pushed a commit that referenced this issue Sep 11, 2021
…501)

- necessitated a decoupling of the files from the valid files; the iterator now only uses the content dict for both filenames and contents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants