A
A
Antoonio542019-09-13 12:46:26
SQL
Antoonio54, 2019-09-13 12:46:26

Functionality, then layout, or vice versa?

It was decided to add new functionality to the site in the form of a blog.
Those. a general page is created where a list of articles will be displayed, as well as a page for the article itself. Accordingly, you need 2 templates, for the general and for the article.
The question is, how to do it right:
1. First, let the layout designer make up everything from layouts in html + css and then give this code to the programmer along with the functional specification?
2. Or first, let the programmer create functional pages without caring about the design, and only then, when the functionality is tested, give him html + css to pull the layout?

Answer the question

In order to leave comments, you need to log in

7 answer(s)
M
mletov, 2018-04-07
@suhuxa1

SELECT t1.date,
     t2.income,
     t3.outcome
FROM
(
  SELECT date 
  FROM payments
  UNION
  SELECT date
  FROM cash	
) AS t1
LEFT JOIN
(
  SELECT date,
         SUM(income) AS income
  FROM payments	   
  GROUP BY date
) AS t2
ON t1.date=t2.date
LEFT JOIN
(
  SELECT date,
         SUM(summa) AS outcome
  FROM payments	   
  GROUP BY date
) AS t3
ON t1.date=t3.date

A
Andrey bb, 2018-04-07
@lblb

And the columns income and outcome - why?
Something like this:

select date
  , sum( case when ppcc.dt = 1 then ppcc.sum else 0 end )
  , sum( case when ppcc.dt = 0 then ppcc.sum else 0 end )	
from (
  select
    pp.date		as date
    , 1			as dt
    , pp.sum 	as sum
  from payments pp
  union all
  select
    pp.date		as date
    , 0			as dt
    , pp.sum 	as sum
  from cash cc
  ) ppcc
group by ppcc.date

PS It would be correct to store everything in one table, then the question would not arise.

M
Maks Codov, 2018-04-07
@4604590

add group by p.date

D
d-stream, 2018-04-07
@d-stream

select 
date,
sum(dbt),
sum(crd)
from(
select date, summa as dbt, 0 as crd  from t1
union all
select date, 0 as dbt, summa as crd from t2
) as t3 
group by date

W
WhiteBearDev, 2019-09-13
@Antoonio54

Option 1.
It is easier for a layout designer to create a clean html code than to understand the code of a backend developer later. Not to mention the presence of complex branches, which will add confusion and may lead to the omission of some branches.

S
Sergey, 2019-09-13
@gangstarcj

3 option. You write TK, which clearly describes what should be. You give it to the coder and proger. They start working together, one typesets, the other prepares the functionality. After the layout is ready, the programmer easily and naturally pulls it on his functional

D
dmitriy, 2019-09-13
@dmitriylanets

1 option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question