webOS controllers and assistant - webos

I've started tinkering with webOS and it's pretty cool. Out of all the major smartphone platforms I have to say that webOS is the easiest to work with. Currently I'm just trying to get an intuitive sense for the framework and I'm just tinkering with basic stuff like event handling, pushing and popping scenes, etc. This has gotten me far but I'm getting to the point where my applications need a little more modularity since they no longer logically fit on a single stage with multiple scenes. I would like to know how do I go about writing my own assistants and controllers and using them in my code?

Are you using Eclipse with the plug in installed?
Even if not, just copy a basic controller and change around the class names everywhere you see it.
Say HomeController to PreferencesController
Add that preferencescontroller.js to your sources.json file and add a folder in the views called preferences with a file in there preferences_scene.html (I believe).
Since the current framework is MVC, you may also want to think about creating javascript models that would house your validation and even helper files that could be global or view specific. None of this is truly enforced except through your own doing though.
Also, beyond that, in 5 days HP will have a conference that shows off their new devices and possibly even their new modular framework titled Enyo, so that may be more what you are hoping for.

Related

Codeigniter and Google maps Api V 3

I am looking for some advice from somebody who has used Google maps and Codeigniter. I am new to maps and working on a project that is built with Codeigniter and uses Google Maps. I am wondering whether to incorporate it directly into the project or use a library for it.
I have found a library here - http://biostall.com/codeigniter-google-maps-v3-api-library and have started using it and have found it easy to use for incorporating maps. I am wondering however if anyone else has used it and if so does it have the full functionality of Google Maps.
I know that Google Maps has amazing features and I am a bit anxious to continue with the library and discover later in my project that it doesn't support the functionality I might need. I am going to keep researching it but if anyone has experience with it I would appreciate some advice.
Yes, I've used two different Google Maps libraries for CodeIgniter 2.
I ended up keeping the one you've linked for both projects. It was cleaner to use than the other, less helpers to load and lines to write in order to create a simple map. I don't know what else you're really looking for here. Also, with this library, I only needed to pass two variables into the View... where with the other, the View needed a bit more complex code. Really, there's only two variables that need to be passed into the view... the Map and the JavaScript for the map. If you're clever, you could also combine them into one.
Quote OP:
"I know that Google Maps has amazing features and I am a bit anxious to continue with the library and discover later in my project that it doesn't support the functionality I might need."
So what? If that's your only concern, then don't worry. Switching out something like this is pretty easy. Since it's invoked and configured in your Controller (or it should be), there's relatively little code to change.
(The developer was also very responsive to my support requests, which is saying a lot for a open source project.)

Is it good to use a formbuilder?

I've been doing web development / design for about five years now, and I was about to go onto Dreamweaver as I thought it would make it so much easier to make websites. Later on I heard that it is discouraged to use WYSIWYG editors to build websites as it add "unnecessary code" to your project. I then heard that if you try to write scripts in Dreamweaver, it messes it up.
Now I am trying to get into software development. I've downloaded Netbeans to play around in Java, and it offers some thing like .NET how I can just drag controls onto my GUI. The only programming I actually do is making the buttons do stuff. I don't see myself learning very much Java is I stick to this, but I don't see myself learning it anyway...
I know that I shouldn't be using this to learn, however I would like an opinion from somebody who has experience in software development.
Is using a formbuilder to build GUIs as bad, or worse, than using a WYSIWYG editor to build websites? Is this a good way to learn how to code software?
Form builders and WYSIWYSG's have their place. I think you'll find that many developers don't use them because most developers are control freaks. It also depends on the specific one your using and your target environment/language. It's not bad to use a form builder, but IMO you should learn how to create the UI elements programmatically before using one so you understand the properties and methods for the different controls. Also, the form builder is only useful to lay your UI out. The majority of the work will be the layers that cater to the UI logic.
There's nothing wrong with using them, but you'll likely need to access properties or methods of your controls in code to facilitate the presentation logic, so you'll still need to learn the controls you use.
Hope that helps.

In the MVC, the handling events code should put in the controller or view?

if the user press the button, handling this event should put on controller or event? Thanks.
It really depends of the platform you are working on, because there are huge differences with desktop development (like .NET's WinForms / WPF or Java's Swing versus ASP.NET and Java Servlets or PHP, for example).
In desktop programming the event system makes it really easy (and sometimes even natural, depending how you look at it) to do a lot of the work in the event itself, but eventually you'll find yourself coding A LOT of the program's logic there, making your view a mess. In web programming this is harder to do because you can't really to much of the system logic in the browser (you can't open a connection to the database, you don't have access to the session or any other kind of information that wasn't previously make available by the server).
Also, it is much easier to apply MVC in Web development because of the nature of how the requests and responses work. On the other hand, when programming to Desktop everything is right there at your need, you can easily access any control from probably everywhere, and even if you don't, you will think it is OK (even when it's not) to share things using static variables (or a lot of singletons).
To make a long story short, I'd say that you should make all necessary efforts to resume logic programmin in the events as possible. With some practice, you will discover that delegating the logic to a regular object instead of the view itself will make your life easier in the long shot.
In time: the kind of controller that you use could be important too. For example, ASP.NET uses some kind of Page Controller, while many PHP and Java frameworks are more kind to use a FrontController (it's not a rule of course, but can make a difference of how you see things).

Modifying Code Igniter

I am looking into developing a commercial application using PHP. Since I have experience in CodeIgniter and it has been working well for me, I decided to use it. Now, if ever my application comes to a point that it needs to grow and have to have custom modifications in the platform, is it possible to modify the CodeIgniter source code to the point that it's far from the original?
I'd strongly recommend not modifying the source code as this is the back bone of the application will make updating to futures releases of codeigniter impossible.
Instead you should be creating your own classes/libraries that extend the core bases. This is best practice.
The codeigniter users guide has some fantastic information regarding this, http://codeigniter.com/user_guide/general/creating_libraries.html
Good luck.
Don't modify it, extend it. Ellislab is good about releasing bug fixes and patches, and the last thing you want is to have to re-engineer all the updates into your new hybrid everytime they release updated source code. Plus, different features and bug fixes are released at different paces for the core and reactor, so unless you plan to lock your framework in at the current version, extending is the way to go.
The good news is CI is built for and encourages extensions of the source. The system folder and the application folder separation are a clear indication of how you should segregate your enhancements from the base libraries.
CodeIgniter is written in PHP. You can completely rewrite the framework anyway you like. So the answer is "yes".
There are many big websites that were written in a different language or build on a framework when they started and have been rewritten many times since. I think a lot of developers (mostly freelancers) are over-thinking when starting out. When I start a project, then I try to get it done and get it out in the web asap. If a website starts taking of - and most of the times start making you money - then you can always take the time to rewrite it.
I think it is a lot more important to spend time when you plan and design your database and tables. I think it is a lot harder to redo parts of your database later on then it is to rewrite the code that uses the data.
Just my 2 cents.
If you have used CI, then you should know that being a PHP framework that all of the source-code is there in the download, furthermore opening the system and application folders and looking through there will tell you a lot. Yes all of the source is there in plain English (plain programming English) and not only is it in plain English but has been extensively documented inside and out (literally that is in the source and in the user-guide). CI gained initial fame from that simple fact, that all code is extensively and meticulously documented.
Beyond all that, the question itself raises concerns that maybe you should study CI a bit further before writing commercial applications using it. Ci is a powerful and very easy to use PHP framework, but it is not a WYSIWYG. In my opinion, a coder should know his tools inside and out in order to be able to create a solid secure and trusted application. The first measure of which is to read the user manual, you should know at the very least everything in it, and since there are 12 sections in it that cover everything from extending CI libraries to creating your own libraries, and everything in between I would say you need to spend a little more time with it.
I want to say though, I am not being rude or trying to shame you in any way I am simply saying that you should learn the framework a bit more before venturing into a commercial application using it.
In the early days of PHP people realized how amazingly easy it was to use and how fast you could write an application with it. At the time the major options where very difficult for new and hobby programmers to use or involved expensive software to run, PHP was free, easy to learn and most of all ran on a free OS. It also took hardly any setup to get going, you could download PHP and essentially be programming in minutes. All of these factors lead to the almost destruction of the language.
Entry level programmers were destroying it with bits of code taken from other applications, never knowing (or caring) what the code actually did beyond the simple fact that it did what they wanted at the time, never considering or even investigating if the code might be harmful. Because of this practice PHP applications that had grown to Goliath sized websites, taking thousands of hits an hour were:
beginning to crash
being hacked to reveal sensitive customer/client data
generally crumbling all around the web
All because since the language was so easy to use that people had taken advantage of it and failed to take time to learn it. PHP was becoming a joke to other professional programmers and wasn't even thought of as a viable application language by many who had dubbed it "the copy and paste" language.
So my advice to you, please take the time to know your tools inside and out, what makes them tick, if they have any gotchas and where they are vulnerable. I understand that in order to learn a language to a professional level you have to build with it so I suggest that you take it slow with CI stick to the core for now. Trust me when I say that even in its purest form CI is an amazing and powerful tool that in the right hands can create awesome powerful web application, but in the uneducated/inexperienced hands it can create havoc and destruction.
So (stepping off of the soap box) I simply ask that if you are serious about creating commercial applications period that you take your time and learn your tools/language become as close to an expert on them as possible. I gurentee that if you do that you will always have work when you need it and you will spend less hours beating your head against the table or worse explaining to a client why their site is down.
I truly wish you good luck, just slow down and learn your trade and you will do just fine.
Yes, Codeigniter is an open source framework. However, I would advise against modifying the core of Codeigniter, as most files can be extended and rewritten safely without modifying the core files which will cause you headaches if you ever decide to update.
To extend a core class by default you would do this in Codeigniter. We'll extended the parser class for this example, but this applies to all classes pretty much. This link in the comprehensive user guide will give you all the information you need to extended and overload methods inside of a Codeigniter core class: http://codeigniter.com/user_guide/general/core_classes.html

Beginner GUI question, organising different "views"

I've done plenty of programming before for CLI and the web, however recently I am getting into desktop GUI programming.
Most of the tutorials for GUI programming I found just explain the different controls you can use and leave it at that. Some of the better ones also skim over a few usability issues.
However, my problem is not with the APIs, or the theory but with my code.
How are you supposed to organise different views your application might have (e.g. a IM application has a login view, a contacts list view, a conversation view etc.).
Are these supposed to be different classes or different methods on one class?
Different panels that are hidden and revealed, or different windows altogether?
I'm hoping for answers as language agnostic as possible, but in case that's not possible, the languages/frameworks I am considering are Java/Swing or C#/WPF. However, if there's another language/framework that is significantly better for learning from, I would consider using that.
Normally each view will be a seperate class in a seperate file. The class will then most likely implement some base class like Window or Control.
As far as organization, if it's a simple app, put them in the root or in a UI folder. Or perhaps a Window folder and Controls folder.
If it's a large app with several views, than break them out into functionality, i.e. an IM folder.
I would say go with what Joshua said and as far as using different panels that are hidden and revealed, i've worked on old code and it's a nightmare to re-use (8000+ lines of Delphi 6!) so stick with different windows as much as possible!
The generally recommended overall structure of the program is the model-view-controller (MVC) type of structure. So, first off, don't make the actual data part of the views, it goes into the model. From here, since the only data in each view window is now almost entirely just layout information and what to do on an action (click, data display, etc), if these are different, they should probably be different classes. If there's some general functionality that can be factored out, you can make this a base class and inherit from it, but in the end, windows with different functionalities should be different classes.
If you are going to be using one of the mainstream IDEs it will handle some of this work for you. The default will be a different class for each form. Hidden panels and tabbed interfaces are nice features but do yourself a favor and learn the ins and outs of embedding groups of controls into form. Some frameworks allow you to directly embed one form into another. Others have special containers that can be be embedded.
The point of these is to break up your functionality so you don't wind up with a bloated form class that's difficult to wade through.
I would also spend some time looking at some of the architectural patterns for keeping your business logic separate from your UI. Check out this link for a good starting point.

Resources