1602637200
At first, you got a nicely structured Alloy controller, but as you go on, new features keep getting added, and slowly but surely you end up with a monster. Your XML file might still look okay, but your controller file starts getting hundreds of lines and the end is not in sight. Sound familiar?
How do you restructure such a mess into a well-structured file again without rewriting the entire thing? It is easier than you might think.
There are actually a few steps you can take to make refactoring easy, like moving more UI elements to XML. From there, it is easy to structure your code. Just follow along with a simple one in your code, and then apply that to all of them, one by one, until your code is clean again.
The first easy fix is to move any eventListeners on existing UI elements to your XML file. This saves you quite some space in your controller and gives you a clear overview of which UI components listen for user input. If you have this now
JavaScript
1
$.myButton.addEventListener('click', myFunction);
You should replace it with this:
HTML
1
<Button id="myButton" onClick="myFunction" />
Any event is always preceded with on and then your event starts with an uppercase character. The rest of the casing on the event should remain the same.
If you have an anonymous function like this
JavaScript
1
$.myButton.addEventListener('click', function(e) {});
Then you should first name your function, I usually give the functions a predictable name which is structured like handle[id][eventName], like this: handleMyButtonClick(), and then you can again move the eventListeners to your XML file.
If you have a UI element that sets a different listener based on a certain condition, then you need a new function that handles all these conditions. For example, if you have a Button that either checks or unchecks something, create a function, and perform the needed logic in that function to determine if you need to do a check or uncheck. By creating multiple event listeners for the same UI element you’re creating more complications in your code which makes things much harder to debug.
There is absolutely no need for two listeners. And in the case you have certain listeners that do nothing in certain situations, like a button click on a greyed-out button, then again, do this verification inside the handler function, do not add or remove listeners on the fly.
You can even store state in the button element itself, as custom properties on any UI element are allowed. So you could set $.myButton.hasDisabledState = true
and read this property inside your click handler. These custom properties can also be set in the XML and
#tutorial #web dev #controller #refactor #alloy controller #javascipt
1602637200
At first, you got a nicely structured Alloy controller, but as you go on, new features keep getting added, and slowly but surely you end up with a monster. Your XML file might still look okay, but your controller file starts getting hundreds of lines and the end is not in sight. Sound familiar?
How do you restructure such a mess into a well-structured file again without rewriting the entire thing? It is easier than you might think.
There are actually a few steps you can take to make refactoring easy, like moving more UI elements to XML. From there, it is easy to structure your code. Just follow along with a simple one in your code, and then apply that to all of them, one by one, until your code is clean again.
The first easy fix is to move any eventListeners on existing UI elements to your XML file. This saves you quite some space in your controller and gives you a clear overview of which UI components listen for user input. If you have this now
JavaScript
1
$.myButton.addEventListener('click', myFunction);
You should replace it with this:
HTML
1
<Button id="myButton" onClick="myFunction" />
Any event is always preceded with on and then your event starts with an uppercase character. The rest of the casing on the event should remain the same.
If you have an anonymous function like this
JavaScript
1
$.myButton.addEventListener('click', function(e) {});
Then you should first name your function, I usually give the functions a predictable name which is structured like handle[id][eventName], like this: handleMyButtonClick(), and then you can again move the eventListeners to your XML file.
If you have a UI element that sets a different listener based on a certain condition, then you need a new function that handles all these conditions. For example, if you have a Button that either checks or unchecks something, create a function, and perform the needed logic in that function to determine if you need to do a check or uncheck. By creating multiple event listeners for the same UI element you’re creating more complications in your code which makes things much harder to debug.
There is absolutely no need for two listeners. And in the case you have certain listeners that do nothing in certain situations, like a button click on a greyed-out button, then again, do this verification inside the handler function, do not add or remove listeners on the fly.
You can even store state in the button element itself, as custom properties on any UI element are allowed. So you could set $.myButton.hasDisabledState = true
and read this property inside your click handler. These custom properties can also be set in the XML and
#tutorial #web dev #controller #refactor #alloy controller #javascipt
1601012358
Big Data has played a major role in defining the expansion of businesses of all kinds as it helps the companies to understand their audience and devise their business techniques in accordance with the requirement.
The importance of ‘Data’ has been spoken very highly in the modern-day business. Thus, while using big data analysis, the companies must keep away from these minor mistakes otherwise it could have a major impact on their performances. Big Data analysis can be the silver bullet that can answer your questions and help your business to scale newer heights.
Read More: Silly mistakes that can cost ‘Big’ in Big Data Analytics
#top big data analytics companies #best big data service providers #big data for business #big data technology #big data mistakes #big data analytics
1595315143
The rapid growth of technology has led to many people opting for online services, and thus the collection and maintenance of data becomes a significant factor for any company. Big data analytics service providers can help the companies get a massive edge over their competitors as they would manage the data well and allow the businesses to make better business decisions. It will provide you with a combination of increased customer experience, revenue, and reduced cost and thus will create a win-win situation for your business. Big data technologies will be your perfect ally in excelling in the cut-throat business environment and come out with flying colors.
Read More: Big Data can be The ‘Big’ boon for The Modern Age Businesses
#big data analytics service providers #top big data analytics companies #impact of big data on businesses #best big data consulting firms #big data #big data for businesses
1624614422
Traditional data processing application has limitations of its own in terms of processing the large chunk of complex data and this is where the big data processing application comes into play. Big data processing app can easily process complex and large information with their advanced capabilities.
Want to develop a Big Data Processing Application?
WebClues Infotech with its years of experience and serving 350+ clients since our inception is the agency to trust for the Big Data Processing Application development services. With a team that is skilled in the latest technologies, there can be no one better for fulfilling your development requirements.
Want to know more about our Big Data Processing App development services?
Visit: https://www.webcluesinfotech.com/big-data-solutions/
Share your requirements https://www.webcluesinfotech.com/contact-us/
View Portfolio https://www.webcluesinfotech.com/portfolio/
#big data consulting services #big data development experts usa #big data analytics services #big data services #best big data analytics solution provider #big data services and consulting
1608022715
An extensively researched list of top Microsoft big data analytics and solution with ratings & reviews to help find the best Microsoft big data solutions development companies around the world.
An exclusive list of Microsoft Big Data consulting and solution providers, after examining various factors of expert big data analytics firms and found the equivalent matches that boast the ace qualities with proven fineness in data analytics. For business growth and enterprise acceleration getting inputs from the whole data of the organization have become necessary, thus we bring to you the most trustworthy Microsoft Big Data consultants and solutions providers for your assistance.
Let’s take a look at the List of Best Microsoft big data solutions Companies.
#microsoft big data solutions development companies #microsoft big data analytics and solution #microsoft big data consultants #microsoft big data developers #microsoft big data #microsoft big data solution providers