« first day    last day (190 days later) » 

1:04 PM
Hello
 
1:15 PM
Hi @Grischa
 
Unfortunately I have no idea how to start the script from scratch. Now I have begun to use my system for german verbs.
 
okay
but you still want to improve it, right?
 
sure
 
I think you picked the right part to start with
and I should have made a better review that contains more code
did you ever work with classes in PHP?
 
no
 
1:29 PM
then I'd recommend you read up a bit on them
 
on php.net? I can't often find good sites to learn PHP
 
I haven't done PHP in a long time and cannot say much about the quality of resources but I believe php.net is a canonical resource to look at
 
basically all of the links on the site I just linked
I am not sure if it is built up in a good fashion to be consumed by novices
the idea is that you need to be able to understand code that is posted as a review
 
you mean: $conjugator = get_conjugator($verb, $tense, $person);
$conjugated_verb = $conjugator->conjugate($verb);
 
1:40 PM
That is only a very rough outline and does actually not feature the details that are necessary
that's what I meant when I said my review should have been better
 
I don't understand, why I should use classes. What are the benefits?
I read on another site about using many functions.
 
In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions, methods). In many languages, the class name is used as the name for the class (the template itself), the name for the default constructor of the class (subroutine that creates objects), and as the type of objects generated by the type, and these distinct concepts are easily conflated. When an object is created by a constructor of the class, the resulting object is called an instance of the class...
Using many functions is not an improvement on its own
A usual rule is: A function should do only one thing (single responsibility principle) and be rather short
if it becomes longer, subtasks of the function should be moved into own functions
this makes it easier to read, understand and reason about the code
 
So, could you explain what is hard to read in konjugator.php?
 
take for example array_wlk
 
;-) That isn't my code ( only some if conditions)
 
1:50 PM
in the pastebin I can't even find where the function ends
okay, I cannot see what is yours and what isn't
 
no problem
 
should I concentrate on the code you posted in the question?
 
no
 
so what should I write about? is anything from konjugator.php okay, despite not being your code?
 
You mean in the answer or here in chat?
only the idea for array_wlk and many parts from index.php isn't my code
 
1:56 PM
here in chat. you asked "could you explain what is hard to read"
 
I thought we are talking here for improve the whole system not this excetion part form the question ...
 
we are, I just thought you objected when you said "That isn't my code"
but lets get back to konjugator.php
and specifically array_wlk
it is a prime example for a far too long function
each gruppe should probably be separated into its own function
 
this is my code for the german verb conjugation (without excetions, only some addition changes for Konditiv II Futur I and II is missing)
 
short question: do you use source control?
 
you mean putting files in pastebin.com Paste Exposure: private?
 
2:09 PM
no
I mean csv, svn, git, mercurial, ...
 
I use CSV for some vocabulary translations ...
 
sry type, I mean CVS
 
not for this script
 
not comma separated values
 
no
This is for saving each version of a script?
 
2:11 PM
yes
to get a backlog
I would recommend you start using something like git
hell, even CVS is better than doing it by hand
 
how to use it?
over github.com?
 
if you don't have a problem with making your code public you can use github
there are alternatives
like bitbucket
and using git you can simply have a local repository
 
I don't understand how to see the result, when using such a plattform
 
github (and the likes) is no platform for hosting a website
it just stores/backs up the code for you
 
what is the difference to backup the files by hand, or upload by hand the files to github or bitbucket?
 
2:18 PM
A component of software configuration management, Revision control, also known as version control or source control, is the management of changes to documents, computer programs, large web sites, and other collections of information. Changes are usually identified by a number or letter code, termed the "revision number," "revision level," or simply "revision." For example, an initial set of files is "revision 1." When the first change is made, the resulting set is "revision 2," and so on. Each revision is associated with a timestamp and the person making the change. Revisions can be compare...
the german wiki has a novice friendly section
using (automatic) version control is by far superior to doing backups by hand. it also is orthogonal to backups
 
for example you and I changing konjugator.php on github, I have to copy all code to my real konjugator.php to check it?
 
I am not sure if I understood you correctly:
using git and github we could both work on the code in parallel, later merging together the results
if we did a good job of splitting the work, the merging process is automatic
if not, it requires some manual work
however, it is far less work than having worked in parallel and then tried to merge everything by hand
or even worse: say we both worked on it and had access to the server where it is hosted
 
So, you will say you would work on the code?
 
we are done with our change and upload it
I would work on it as far as the review process here is concerned
just to finish my example: we don't know the other worked on it and uploaded it, so the last to upload his changes overwrites the changes from the other
 
which plattform do you use?
I understand your example already ;-)
 
2:25 PM
Use for what?
 
for source control
 
I use git
 
on github.com?
 
yes, for some projects
for others I have my private server
 
can I use github for free, if I had not much files?
 
2:30 PM
for open source repositories github is fully free, private repositories require a subscription fee
at least that is my current knowledge
 
that is correct
I don't understand, how to upload a example file on github
 
I think you have not yet understood the principle of git
 
Congrats for your first commit :)
 
could you correct the code?
 
I could but I think that would be too localized
btw. what editor do you use for writing it?
 
notepad++
 
the indentation looks a bit off sometimes
there are several errors in the code
you should at first get the code to a working stage
 
3:00 PM
it works now
now all 4 variantes working
 
okay, the code is still missing <?php ?> but it is working with them
 
3:20 PM
no all 6 variantes works
 
hmm
that is rather hackish
 
"poorly designed workarounds" yes ;-)
 
lets see
first of all there are too many magic numbers
you should replace this at least by enums
and rename the variables
 
you mean the echo part or the foreach part?
 
$test -> $zeit (form)
@Grischa both
 
3:26 PM
test and www was random words
 
obviously
naming things right contributes to a better understanding of the code
 
what are magic numbers?
 
In computer programming, the term magic number has multiple meanings. It could refer to one or more of the following: A constant numerical or text value used to identify a file format or protocol; for files, see List of file signatures Distinctive unique values that are unlikely to be mistaken for other meanings (e.g., Globally Unique Identifiers) Unique values with unexplained meaning or multiple occurrences which could (preferably) be replaced with named constants == Format indicator == === Magic number origin === The format indicator type of magic number was first found in early Seve...
 
you mean to rename the arrays ?
 
those too
but lets take for example:
$werden_array[0][1]
 
3:33 PM
$werden_array[indikativ_futur1][1] ?
 
yes
and the second number as well
 
$array = [
"ich" => "ich",
"du" => "du",
];
 
what do you want to achieve there
 
I want replace 4 (later 6 functions) and 6 arrays with one array and this foreach
 
that might be possible but sounds messy
I will be leaving in about 10 minutes
 
3:45 PM
none of their examples works
 
this class is part of PECL, which you might not have there
it was more as a guideline
you can nearly take that code as is, you just have to remove the extends SplEnum
you will lose some of the functionality but not the part we are interested in
the idea would be to have a class Zeitformen
where praesens, futur1 ... are defined
 
the error is in the part that we would not use
you define the class and then use it for the array access
$werden_array[Zeitform::Futur1][Person::ErsteSingular]
I am not quite sure if your array is fully orthogonalized
 
4:12 PM
well I got to go now
bye @Grischa
 
bye bye
 

« first day    last day (190 days later) »