refactoring | Refactoring Web Interfaces
kandi X-RAY | refactoring Summary
kandi X-RAY | refactoring Summary
Whether you’ve been using Sass for a while or are still trying to figure out how to abandon plain CSS, refactoring a large project can be a daunting task. We all know it’s too hard to refactor everything for months and launch it all at once, so how do you begin a multi-step refactoring process?. Jina Bolton is a San Francisco-based designer and developer best known for her work with Team Sass Design, speaking at conferences, and co-authoring two books: Fancy Form Design and The Art & Science of CSS. Currently she’s a Senior Product Designer with Salesforce UX on the Systems team; she works collaboratively across product teams to help identify and document interaction and visual design patterns. Elyse Holladay is a developer and instructor at MakerSquare, an Austin-based dev school. She has been involved in two large refactoring projects: taking three separate HTML & CSS codebases to a single, shared Sass codeset and a complete UI overhaul of a multi-app enterprise project. Their experience in maintaining large codebases has given them insight into the pitfalls—and joys—of refactoring. In this four-hour workshop, Jina and Elyse will walk you through the basics of refactoring using Sass. You’ll receive guidelines for how to refactor for clarity, maintainability, efficiency, and DRY code, and learn how to test your changes. They’ll cover ways to break down a refactor into manageable chunks, help you understand how to modularize your CSS, and organize messy code into documented, style-guide ready files. Everyone will leave with a customized game plan of steps, tools, and guidelines to refactor their project—not a sample app—so bring your project code with you.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of refactoring
refactoring Key Features
refactoring Examples and Code Snippets
Community Discussions
Trending Discussions on refactoring
QUESTION
When learning rust closures,I try Like Java return "A Function"
...ANSWER
Answered 2021-Jun-12 at 03:05The compiler seems to be complaining that it's expecting a type parameter but finds a closure instead. It knows the type, and doesn't need a type parameter, but also the size of the closure object isn't fixed, so you can either use impl
or a Box. The closure will also need to use move
in order to move the data stored in x
into the closure itself, or else it wont be accessible after equal_5()
returns, and you'll get a compiler error that x
doesn't live long enough.
QUESTION
I'm refactoring code and wonder if this is possible.
...ANSWER
Answered 2021-May-06 at 17:20This is what i was doing
QUESTION
I have a fairly large PHP project that I recently did a ton of refactoring on. This isn't a 'spaghetti code' situation but more so a 'wait a minute.. what files in this project are actually used?'
Is there an easy way to (similar to checking for code coverage?) pare down the file structure to only the files that are in use, or will I need to write some more code to determine that?
TLDR: I'm wondering if there's a tool that will keep track of what files are used in a project and what aren't
...ANSWER
Answered 2021-Jun-11 at 22:05Here's one method (among many I'd guess). This is not production ready - just a hackish tool for you to assemble a list that you can parse out later. Or an idea you can take and make more robust.
create a php file in a directory
tracker.php
QUESTION
This explains the "Bridge" pattern I'm referring to: https://refactoring.guru/design-patterns/bridge
Here's a scenario from the post above:
Say you have a geometric Shape class with a pair of subclasses: Circle and Square. You want to extend this class hierarchy to incorporate colors, so you plan to create Red and Blue shape subclasses. However, since you already have two subclasses, you’ll need to create four class combinations such as BlueCircle and RedSquare.
The problem this scenario presents:
Adding new shape types and colors to the hierarchy will grow it exponentially. For example, to add a triangle shape you’d need to introduce two subclasses, one for each color. And after that, adding a new color would require creating three subclasses, one for each shape type. The further we go, the worse it becomes.
To avoid this problem, we implement the Bridge pattern like so:
Extract the color-related code into its own class with two subclasses: Red and Blue. The Shape class then gets a reference field pointing to one of the color objects. Now the shape can delegate any color-related work to the linked color object. That reference will act as a bridge between the Shape and Color classes. From now on, adding new colors won’t require changing the shape hierarchy, and vice versa.
I understand the how and why of this implementation.
But what if we need a third hierarchy, e.g. BorderStyle
(where a border style can be Straight
, Wavy
, or ZigZag
?)
I guess we could implement a second Implementor class for BorderStyle
and pass it into a Shape
constructor like so:
ANSWER
Answered 2021-Jun-10 at 00:45Yes, this works. There's nothing wrong with adding two Bridge relationships to one abstraction (beyond the complexity of juggling three different hierarchies).
Decorator would certainly not work for this purpose, because it maintains a single hierarchy, which is known to the client. The Implementor
hierarchy in a Bridge (or hierarchies in this case) are unknown to the client.
I would make a clarification to the linked article, where it says,
You want to extend this [shape] class hierarchy to incorporate colors
I think this oversimplifies the motivation for a Bridge. The Implementor
s are not just some attributes you choose to add to your Abstraction
to enhance it. Your Abstraction
requires an Implementor
in order to function at all. The method implementations within subclasses of Abstraction
generally do little except call methods of the Implementor
.
The Abstraction
represents your high-level, business API, while the Implementor
represents a lower-level, primitive API. They are both abstractions, but at different levels. I don't think this is conveyed adequately by shape & color examples because shape and color seem like abstractions at the same level. Both shape and color would be known to the clients, and neither one strictly depends on the other.
So a Bridge is applied for more specific reasons than the given example, but you certainly can have two.
QUESTION
I've got the following code in a terraform module:
...ANSWER
Answered 2021-Jun-09 at 06:48Your dynamic block should be:
QUESTION
I spent some time last year trying to learn fp-ts. I've finally come around to using it in a project and a lot of my sample code has broken due to the recent refactoring. I've fixed a few of the breakages but am strugging with the others. It highlights a massive whole in my FP knowledge no doubt!
I had this:
...ANSWER
Answered 2021-Jun-09 at 03:41Let's start with your question
what is meant by 'Use small, specific instances instead' as well for option and array?
Prior to fp-ts
v2.10.0, type class instances were grouped together as a single record implementing the interfaces of multiple classes, and the type class record was named after the data type for which the classes were defined. So for the Array
module, array
was exported containing all the instances; it had map
for Functor
and ap
for Apply
etc. For Option
, the option
record was exported with all the instances. And so on.
Many functions, like getFoldableComposition
and sequenceT
are defined very generically using "higher-kinded types" and require you to pass in the type class instance for the data type you wanted the function to use. So, e.g., sequenceT
requires you to pass an Apply
instance like
QUESTION
Let's say I have the interface AuthorDao
with two different implementation classes for example MyAuthorDaoImpl1
and MyAuthorDaoImpl2
.
In my interface AuthorDao
I have some basic crud methods and one extra method which is static
for getting a new instance of MyAuthorDaoImpl1
.
It looks like this:
...ANSWER
Answered 2021-Jun-08 at 12:34This implementation is a circular dependency, which roughly looks like:
While it will likely work in Java, imagine what would happen if you no longer included the class MyAuthorDaoImpl
when later you decided to implement ABetterAuthorDaoImpl
. Now you have to change the interface. It is a minor change in this case, but imagine it on a larger scale.
Normally a factory method returns the interface type rather than the implementation type. Example:
QUESTION
New to cypress, but did a couple projects in Protractor and TestCafe.
I'm aware of the controversy using PO's in cypress, but due to the complexity / nature of our app, we're going with it.
Refactoring the test to remove PO's and include the app ID's works. With the page objects, we get the 'requires a DOM element' error.
// myPo.js
...ANSWER
Answered 2021-Jun-07 at 15:56You are returning a function reference to cy.get() when you call cy.get(loginPage.forgotPasswordLink). Change It to:
QUESTION
I have been refactoring some docker-compose files to try and take advantage of tip #82 and hit a problem I haven't been able to find a solution to; I'm hoping someone can assist.
Using the following stripped example test-compose.yml
file:
ANSWER
Answered 2021-Jun-07 at 15:35So, two things are going to bite you here:
First, docker stack deploy is fussy about the version you specify, so you need to strictly specify a valid compose version equal or higher than the feature you are trying to use. Not sure when anchor support was added, but it definately works when the version is specified as "3.9".
Your next problem is that merging is shallow. In your example case this isn't a problem because x-test
contains only one setting which is already on its default value, but more generally to handle complex cases something like this is needed:
QUESTION
I'm currently reading the Rust book, and I have just reached the topic closures
.
A detail that has surprised me, is that the Rust book sais that
Closures don’t require you to annotate the types of the parameters
I immeadiatly tested that, since it appeared really counter-intuitive to how Rust usually works. Thus, i copied exactly the closure they used, pasted it into my code, and... got an error:
...ANSWER
Answered 2021-Jun-07 at 09:57The compiler needs to be able to deduce the type of the argument in some way, this can happen through explicit type annotations as in num: i32
or through contextual information such as
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install refactoring
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page