Applicator Titanium - Alloy vs Classic

I am going to start a new Titanium project. Until now, what I wrote is now considered a “classic project” (I wrote Titanium applications before Alloy).

I was wondering if it's worth switching to Fusion for my new project. I know that basically, an alloy is compiled into the "Classic" titanium code before compiling to a java project or an objective-c project. I also know about the great advantage in this process of “pre-compilation”, which should be noted in the alloy code, which is only related to Android or iPhone, and does not apply to another in the compiled “classic” code.

My main problems are flexibility - as with Classics, I feel that I have more control over the code and what is happening.

Secondly, I have controls (for example, an open sliding menu) that are not written for the alloy - how can I have them as part of my project?

I started asking myself, rather, whether to use Fusion or not after discovering (introduced in TiConf 2014) TI UX ( https://github.com/jaraen/Ti.UX.Templates ), which is written for fusion.

a few other questions:

  • How can I run the old user interface code inside Alloy?
  • Can I have controls written to run Alloy in a "Classic" project?
  • Can a “classic” project also display non-iOS / Android code?
  • Is there a difference in performance between alloy designs and classic designs? what about other flexibility issues?

thanks

+5
source share
2 answers

Just in case, someone sees this question and needs an answer:

I also posted this question in Appcelerator Q & A, where I got some answers here: http://developer.appcelerator.com/question/177739/appcelerator-titanium---alloy-vs-classic

The answer I was given is partial, and more information can be found in the questions asked here: http://developer.appcelerator.com/question/177542/classic-vs-alloy

+2
source

I felt that the transition to the titanium alloy from the classics suits me. I felt that the classic development of Titanium was not structured enough and did not give me enough guidance for a good way to structure my application. Alloy provides an MVC structure for your code, but the classic does not completely prevent you from rolling back on your own or using one of the community libraries with MVC capabilities. In this regard, I think I would say that it is more flexible to use the classics over the alloy, because you can choose how to fulfill your structure, rather than embed it in the structure of a titanium alloy. That being said, I never felt confined by the Fusion.

How you develop in Titan is your preference. There is no right answer to using alloy or using classics. If someone works better for you, use it. I feel that a structured approach to separating Alloy display and business logic provides me with a structure that makes sense to me when developing the application.

I did not find that the alloy is less flexible than the classic. Since you can use the classic code in your Alloy project, you can pretty much do everything in the alloy that you can in the classic. I am sure that these are some cases with edges that I have not encountered when one may be simpler than the other when coding a certain type of application. Maybe the classics are less flexible because I don’t think you can use Alloy in your classic application. I don't think the compiler would know how to do this.

Whenever I evaluate whether I will use a specific technology, I make a series of experimental mini-programs to make sure that all the features are present in my applications. If I feel that it is not suitable or too difficult to achieve these requirements, I do not use this technology. For example, when I switched to Alloy, I made sure that the Ti.Paint library would still work. If this were not so, I would still use the classics.

Like the classic, there are controls for Alloy. There is already a pretty smooth splice menu for a sliding menu. I use the Ti.Paint library, which existed before the alloy and is not a special alloy module.

http://gitt.io/ is a decent starting point for finding alloy modules / widgets.

index.xml

<Alloy> <Window id="win"> <View id="content" /> </Window> </Alloy> 

1) In your index.js file, you have the following to use classic encoding to control the Fusion view.

index.js

 var myview = Ti.UI.createView({ backgroundColor: 'green' }); $.content.add(myview); 

2) I do not think that you can use splice code in your classic project. As you mentioned earlier, it should do the code translation, and the classic project will probably skip this step in the process.

3) You ask if you can include or remove parts of the code based on if it is Android or iOS? You could probably do this with include / require statements strategically placed between if (Ti.Platform.osname == "android") statements that require or don't require code. If the code is for Android, this requires this, if it is for iOS, this is required.

4) Never tried to test the performance between classic and splicing projects. I think, since I switched and never noticed the problem that bothered me or my clients, I never thought about it. It is possible that Alloy will automatically generate code, which in some cases is slower. I have never noticed this.

I feel that the efficiency that I find in using Alloy far outweighs this as an immediate problem. Plus, if I felt that I didn’t like the way the special control was created through Alloy, I could use the classic code and determine that the control itself has control over the classic project.

0
source

Source: https://habr.com/ru/post/1202762/


All Articles