DEV Community

Discussion on: Do you implement logic first or focus on styling right-away?

Collapse
 
fjones profile image
FJones

Focusing solely on react, because my workflow for other frameworks is entirely different:

I implement logic first, but I develop UI first. That is, I form the concept and expected DOM before implementing the actual logic. This is because the logic may dictate certain aspects of the ultimate code structure, but it has to play well with the design. Done well, this reduces the styling in the third and final step down to a few instructions, without having to rearrange things too often to fit the blend of elements and logical units.

In rare cases I'll style a non-functioning component first, then attach the logic to it. This is usually done for things like iconography or components with multiple visual styles (e.g. user cards that exist in two different display modes). Here, the logic often ends up in a different component or module anyhow and gets attached to the purely visual component through a purely logical component.

Collapse
 
chrisczopp profile image
chris-czopp

Yeah, it makes a lot of sense to not to have over abstracted logic which isn't in line with the design. Sort of modelling building blocks before putting it all together.