M
M
MistaTwista2015-11-06 21:33:05
SQL
MistaTwista, 2015-11-06 21:33:05

What is the best way to build a family tree?

Tell me the best way to build a tree.
There is no problem to do it on crutches, I'm interested in how to do it more correctly and then ask the database (Postgresql) less.
Problem:
An object can have two parents and any number of children.
So far I have seen ready-made solutions with one parent. Did you miss something? Ideally, it would be a ruby/rails gem, but some algorithm is enough. Or see the SQL query. I'm with him for now :)
I think to get something like from the database:
id;name;lvl;gender;father_id;mother_id
and this is already used to build on the page.
There are no special requirements, it's not scary to get a ring, 3 generations are enough.
upd: Maybe I'm not looking for something at all? Maybe not the tree algorithm, but me? :)

Answer the question

In order to leave comments, you need to log in

14 answer(s)
I
IIISpikerIII, 2015-11-07
@IIISpikerIII

It is convenient to use nested sets for storing tree structures, an explanation of the principle can be found at phpclub.ru/detail/article/db_tree.
The disadvantage of this approach is that each time an element is added to the tree, the changes will affect a large number of rows. But the advantage will be a quick search and navigation with a minimum number of calls to the database

E
EugeneOZ, 2013-11-10
@EugeneOZ

can the contractor be trusted to set deadlines?

Official question.
And who else can be "trusted" with this? To the customer? I imagine a funny picture: the customer, reclining on an armchair, with a cigar, says “what to do here - half an hour, well, a maximum of an hour, this is elementary - a text input field and a button, here's a twitter for you.”
The customer can either be satisfied with the deadlines or not - in this case, he has a market with a set of performers. And only the performer can name the dates.

P
pomeo, 2013-11-10
@pomeo

Freelancers are no different from any other wage laborer at a time.
Let's say I dig, for example, a hole 2 by 3 with a depth of 1 meter, I take 1000 rubles for this. and go to bed at 3 o'clock.
I receive an order for a pit, and as usual 3 hours and 1000 rubles. we talk and start. And in that place bam and 2 large cobblestones, who knew about them, but no one. At 3 o'clock we no longer fit, they also need to be dug up, taken out and moved somewhere. Nobody will pay for this.
Once again, bang and some cable at the site of digging a hole, they forgot to warn. You also need to do something with the cable. If you refuse this hole, no one will give money, and you have already dug up half of it, but the customer doesn’t care, he has a trigger (done / not done).
Another pit, and there is some kind of bang pipe. You are told to dig then elsewhere first. And the fact that this part of the digging should be paid for is nobody's business.
There are an infinite number of such options, here you can add “Why is the pit rectangular, but let’s make it an asterisk” or “Why are you holding a shovel like that, I want you to dig my hole holding a shovel like this”, etc.
Having stuffed a bunch of such cones, you begin to set a deadline of 6 hours and 5000 rubles, according to your calculations, most of such surprises are solved at this time. Only those who turn to you whine: “But a friend of a friend’s son digs for 800 rubles.”
Over time, you spit on all this, open, for example, a cemetery and dig for your own pleasure without any surprises and collect much more money. =)

E
EugeneOZ, 2013-11-10
@EugeneOZ

what you are doing? Are you pushing the deadline? Lower your bonus?

And why are there no options that positively affect motivation? If an employee is not motivated enough to do it on time, maybe it's worth discussing with him what can improve motivation?

P
Puma Thailand, 2013-11-10
@opium

I would like to collect and read the use cases of colleagues (customers, freelancers) in the following cases:
How to evaluate the timing?
Break the task into subtasks, set subtasks hours for which they can be completed, if you don’t know how, then break it into subtasks that can be done in two hours.
For example, I'm a customer, I don't know the materiel for how long this or that functionality can be developed, can the contractor be trusted to set deadlines?
Ask three performers to compare and ask to justify.
A question for freelancers - how often does the customer agree to your deadlines?
And where should he go, as an option, I am ready to work faster in an emergency for a doubled rate of 100 bucks an hour.
A fix for the work, deadlines was agreed, but the next delivery (code, design) fails on time, something has already been partially done.
Those. iteration is not the first, the quality of work is good - what are you doing? Are you pushing the deadline? Lower your bonus?
It's a stupid situation, the risks should be included in the deadlines, if you have this once, then you can shift the deadline, or reduce the bonus or hire more people. But if you have this all the time, then you need to treat the causes, not the consequences.
From freelancers, I would like to know the most common reasons why this happened.
Because gladiolus, laziness, a lot of work at one moment from several customers, improper scheduling, and a million and one more reasons.
If there are interesting examples from life when working with freelancers, but not in these cases, share anyway.
Here you can read and listen about working on the freelance exchange code
pumainthailand.com/category/rabota-2/

Z
zx300, 2013-11-10
@zx300

Well, the question, as I understand it, is not only about time, but also how to work with them in principle. So the ideal option is to find a freelancer who has already solved exactly the same problem, then it all comes down to buying a ready-made solution. I call it a catalog of developments. If this cannot be found, then this, as it were, already hints at the fact that you can’t get off with an hour of work. Break the work into two stages - the first is an estimated one, at which he gets acquainted with the task, at this stage you either pay nothing at all or pay a symbolic agreed amount (calling fee, it is also “for beer”). At this stage, he himself tells you possible options for the development of further events with his participation. They either suit both of you and you cooperate, or they don't suit you and you scatter. Let's remember the plumber - he first looks at your scope of work, only then he says the deadlines,
If the deadlines are not running out, then you can give long-term tasks to novice freelancers. In this case, we agree so, if you do it, well done, if you don’t do it, it doesn’t matter.

W
Wott, 2013-11-10
@Wott

How to evaluate the timing? For example, I'm a customer, I don't know the materiel for how long this or that functionality can be developed, can the contractor be trusted to set deadlines?

It will be difficult for you. As a rule, people are too optimistic and the deadlines named by anyone are constantly broken.
You need to evaluate the realism yourself and throw it on top of the risks
A question for freelancers - how often does the customer agree to your deadlines?

An agreement is a mutual compromise. If the customer unreasonably lays on his own terms, then there will be no agreement
A fix for the work, deadlines was agreed, but the next delivery (code, design) fails on time, something has already been partially done.
Those. iteration is not the first, the quality of work is good - what are you doing? Are you pushing the deadline? Lower your bonus?

Well, firstly, it’s better not to bring it up to the agreed deadlines in advance, to be interested in how things are going there and in general it is desirable to see the progress of the work in the source code. If it is clear that the deadlines are being delayed, then pull out the motivator, but it is better to immediately recalculate the plan and move the deadlines, at least for yourself. In general, to find out on the day of delivery of work that it will not be and it is not clear when it will be - this is your complete fail. But the right PM has the ability to maneuver in this case too - from a time buffer to prepared excuses for interested parties, but this is of course a bad option.
From freelancers, I would like to know the most common reasons why this happened.

Standard - underestimation of the volume of work.
Then banal procrastination.
Then all sorts of force majeure and other more important work for the performer, classes

A
AdrenaLeen, 2013-11-10
@AdrenaLeen

How to evaluate the timing?

As already mentioned above, it is better if the contractor evaluates the terms, and the customer chooses whether to agree to these terms or not. Of course, there are times when freelance customers write “This task needs to be completed by Monday morning.” Then the freelancer evaluates whether he can meet the deadlines. Where does this “Monday morning” come from?
It may be that such a deadline is due to external reasons, for example, you need to submit reports to a certain civil service, and if you do not file it on time, you will pay a fine. There may be several options here. Perhaps you "guess" the deadlines, and they will be comfortable for freelancers, then a sufficient number of freelancers with an acceptable budget will respond to the project. Perhaps the timing will be uncomfortable, but acceptable, then you can roll out a big price tag for urgency. Here you need to look at what is more profitable - to pay a fine or pay a freelancer. Perhaps you set some unrealistic deadlines, then no one may respond to the project. I note that there is a category of freelancers who respond to any proposals, but are not competent enough to complete the task on time.
Option 2. Estimation of the terms is carried out by a competent specialist on your part. But this approach only works if the specialist is really competent. However, there are always risks, and it's best to have a freelancer do the time estimate. If the date is critical for you, it is better to ask the freelancer you like if he will be able to finalize the project by the specified date, and what will be required from you so that he can work as quickly as possible.
A question for freelancers - how often does the customer agree to your deadlines?

If the customer does not agree with my terms, then the question arises whether he will agree with the new budget.
Those. iteration is not the first, the quality of work is good - what are you doing? Are you pushing the deadline? Lower your bonus?

These points are best discussed in advance. If you haven’t spoken and you want to maintain a good relationship with the freelancer, you move the deadline and ask the freelancer how to make sure that he meets them next time. Based on his answer, you evaluate whether you need to look for a new freelancer or continue to work with this one.
From freelancers, I would like to know the most common reasons why this happened.

Lacked motivation.

D
Dmitry Sushko, 2013-11-27
@Suhoij

How to evaluate the timing? For example, I'm a customer, I don't know the materiel for how long this or that functionality can be developed, can the contractor be trusted to set deadlines?
A question for freelancers - how often does the customer agree to your deadlines?

I want to note right away that if a freelancer almost does not ask questions, the estimate will most likely be incorrect. I agree with the opinion that you can ask WBS - work schedule - division into tasks and subtasks - this way you can see if the freelancer understood what needs to be done or just threw a general estimate. As to whether the customer agrees to our terms and how often I will give an example. A portal for revision fell into our hands - it is clear that it is necessary to add a time buffer, because there are risks that when changing the code in one part, bugs may occur in another. The customer said that in his opinion the estimate is too high - we just openly showed why the estimate is too high. In the end, the client agreed.
A fix for the work, deadlines was agreed, but the next delivery (code, design) fails on time, something has already been partially done.
Those. iteration is not the first, the quality of work is good - what are you doing? Are you pushing the deadline? Lower your bonus?
From freelancers, I would like to know the most common reasons why this happened.
I can say from the side of the web team that there may be several reasons for this:
1. Fuzzy Terms of Reference. Haven't figured it all out. It happens like this - you stipulate everything clearly what needs to be done, and when you sit down and write the code, new problems come out that were not foreseen. Therefore, I tell my developers that before writing estimates and saying that they have no questions, mentally imagine in their heads how each module will work - that is, make an assessment on a task-by-module basis.
2. They did not take into account all the risks of the project - for example, the technology was not able to solve the problem,
3. There is no project manager - somewhere the estimate has floated, no one is following this, and accordingly all the deadlines are floating. And the estimates float in different ways - but the main thing we faced at the very beginning was that there was no change request management. The customer said, let's fix it a little here, and let's do it like this - and all this increased the amount of work, but the estimate remained the same.
4. The banal laziness of a freelancer and the inability to calculate his working day.

M
Mitya Kolesnikov, 2013-11-10
@mittus

We usually try not to put pressure on deadlines, especially for people who are starting to fulfill our orders for the first time. Usually we look at estimates, examples of work, after discussing the quality of a particular candidate. After we talk with a potential contractor, the deadlines, of course, are set by the contractor himself. If we strongly want to reduce the time for completing the task, then we negotiate this with the contractor by offering a larger amount of payment from the originally agreed one. There were cases when the performers did not cope with the tasks on time and in such a situation, in such a situation we pushed back the deadlines, but we did not turn to such performers anymore. Somehow, we calculate everything by trial method.

C
codecity, 2013-11-11
@codecity

For example, I'm a customer, I don't know the materiel for how long this or that functionality can be developed, can the contractor be trusted to set deadlines?

If a trifle for 1-2 weeks - please. You won't lose much, the risks are not big.
If the project is long, then it is better for a layman not to start it. If you are a layman in this matter, you need a person whom you trust and who can both set the task and accept the work. That is the project manager.
If you cannot evaluate the work, then there is nothing to climb. 99% failure. One can give a quick result, but inside it is shit code that is not possible to maintain (in a couple of months, all that remains is to close the project). The second will take longer and more expensive, but with high quality.

M
Masterme, 2013-11-11
@Masterme

For example, I'm a customer, I don't know the materiel for how long this or that functionality can be developed, can the contractor be trusted to set deadlines?

Eternal theme. And a complete lack of understanding.
I recommend thinking about it until you start asking questions such as “I don’t own materiel. How do I evaluate the qualifications of candidates? or “I don’t own the materiel. How do I assess the appropriate level of payment for my assignment? or “I don’t own the materiel. How can I check the quality of my work?
There is only one answer to all these questions: no. As long as you do not understand the materiel, you will not be able to control the quality or timing in any way. So just experience, yes. Start small: small task - small pay - result - evaluation. Then either continue to work with this person, or try another. And after a while you will understand everything.

M
Masterme, 2013-11-11
@Masterme

How to evaluate the timing?

In general, the assessment of terms is carried out on the basis of the TOR. TK can be compiled by an individual (who owns the materiel, yeah), preferably no less experienced than the final developer. In the TOR, the whole task is decomposed into points, so it is easier to evaluate labor costs, deadlines and budget. You show the TK to the candidate and listen to his opinion. You can show the TOR without estimating labor costs and find out how many man-hours the candidate will estimate each item. You can find out for each item whether the candidate has done a similar task before. Candidates can be compared based on their responses. Etc. That is, in addition to the contractor, you can involve a technical expert who will make you a technical specification and an audit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question