iPhone Application logic - iphone

I need to develop a client application for a site that host and show images.
The client should shows all new images and take a picture and send to website.
I'm a newbie to iOS programming so this question:
In an application alike this, there's the need to create a Model? I ask this question because I think I can do anything with Controllers but maybe I'm wrong.

While there is never a "need" to create a model, it's good form to do so, and it'll likely save you many headaches down the road. Ultimately, you're going to need to deal with images and websites and how they interact with each other and whatnot, so you might as well do it in models from the outset.
I'm as guilty as anyone for wanting to see immediate results and hack together something quickly, but I always regret it later on, and have to spend more time than I'd expected refactoring it into something usable.

The MVC pattern as used in Mac OS and iOS applications isn't something best explained in an answer box but here's a link to some simple documentation about the roles of Models, Views and Controllers
Some good basic introductions to start with, which also have relevant links to the next stage of documentation are:
Cocoa Core Competencies
Cocoa Application Competencies for iOS
Read these excellent articles first. You'll learn better and faster if you do some basic reading.

Related

Designing a iPhone application

I am into designing a new iPhone application. My application is will contain almost all iPhone SDK concepts including core data, server integration, location services. Is there any design decisions I should keep in mind?
My plan was to go by designing a controller class for each iPhone app screen and also any utility classes to be used. Any guidance will be really appreciated.
I forget who said this first, but it goes like this: The first project you do in any new technology will probably be very bad!
This is similar to these sage words from Fred Brooks - "Plan to throw one away; you will anyway"
So the best way is to wade right in, get dirty, light up the dark corners and learn what works for you. Then you'll most likely have some very specific questions based on your experiences!
This is a tough subject to talk about generally. Design approaches that work for some will fail for others.
It would probably help to know more about what you are trying to do. For a counter-example, I'm working on a game. I create an OpenGL context and from that moment on I'm managing assets like shaders, textures, mesh data, sounds,... . The way I've designed my project will pretty much be useless to you.
However the best advice that I can come up is to really figure out what you are trying to do. Create mockups of your GUI and document workflows. Do sketches of GUIs. Become an expert in the domain in which you want your application to work. Develop a deep understanding of what you are trying to do.
Once you have the GUI figured out, start working on the other end of the Model-View-Controller approach - figure out what data you need in order to provide the GUI that you've designed. Not all data structures are equal. What's the best data design for the domain you're working on?
Once you have the view and model figured out you need to glue everything together with controllers. There's lots of trick and traps here. Do you use threading to prevent the GUI from blocking? Do you make direct calls to objects or do you decouple and use notifications?
But this is the public appearance of your application. You might want to track usage data - consider what you wish to track and append that to your design. Errors happen, so think how to approach them.
However, it's hard to be more detailed without more details than what you've provided. Every application has it's own quirks and gotchas. It's nearly impossible to talk about this in a general sense.

Can I learn the iPhone SDK and complete an app by September? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'm wondering if it's realistically possible to learn the iPhone SDK and complete an app by the end of this summer. The app shouldn't be too difficult, it would just interact with my site's API and essentially just fetch, create, and edit resources. I already have a little experience with the SDK (and I'm comfortable with Objective-C), so I'm not completely new to it. Although here I things I don't know how to do and what I'd need to learn:
Log in to my site using basic http authentication and store the user's username/password for all future requests
Implement a toolbar at the bottom to navigate between different views
Fetch and parse xml into list items
Do POST/PUT requests to create/edit a resource on my server
Are there any good resources available to learn how to do those tasks above? Thanks!
You mentioned creating/editing resources on your server. If you're running Ruby on Rails on the backend, you might find Objective Resource interesting, an Objective-C interface into Active Resource:
http://iphoneonrails.com/
But back to your original question, it all depends on how polished you want the app to be. My advice is, ignore if you can do it and just get started learning. Start with the (free) Stanford iTunes U course podcast.
I learned and published in 3 months. The question is are you comfortable with Objective C (which you are) and are you familiar with cocoa and the MVC pattern?
Basically, unless you are totally new to programming, go for it!
I wrote an Android game in two weeks with out knowing Java or the Android API or that much about game programming.. But I had to copy and paste a lot of stuff from documentation examples and other available source code. It is theoretically possible to learn enough to write an iphone app in that time and build it. But it is up to you to focus and see it through, that is the hard part.
Yes - I've even done it.
I had an internship for 2 months last summer and I managed to learn objective-c and create and polish a fairly complex app within that time.
The way I did it was just to throw myself into it. I knew what needed to be done so I jumped into it. I had a quick look at some open source code for various things to see how other people did it then apply those rules to my own code.
2 important things to remember:
Google and stackoverflow are your friend, if your having trouble with something google and stackoverflow will normally have an answer.
Option, Command and double click on something in your code will open up the apple developer documents and do a search for the thing you double clicked on. This gives a really easy way to check for methods and properties in Cocoa classes.
Yes you can.
My suggestion, learn the basics first. Grab a book - I recommend "Beginning iPhone 3 Development" by Jeff LaMarche & David Mark - read most of the chapters (a few of the later ones you can probably leave for another time if you don't need them yet, but do all the earlier ones) and get your head around the essentials. Do the exercises and code as much as possible. There are plenty of learning resources around the internet too.
Then tackle your app while continuing learning. By this point you'll have fallen across & bookmarked a few relevant web links or grabbed a book or two specific to your app's needs, and it should all fall into place.
Good luck! :-)
Yes!
Other than the advice people gave, you can also check out the iPhone Application Programming course on Open Courseware. But, I warn you, it's a 45h course.
Maybe you can spend a week or so to study the Wordpress source ...
I'm doing pretty much the same thing on OSX development. This is how I tackle it:
Buy relevant books. Amazon and SO provide with the right choices, then buy alot of them and see which one fits. I found that having a good book or two and occasionally reading them outside of your programming environment can really enforce you learning proces.
Work through at least one book, the others are for elaborating on what you have learned.
Start writing you app. This can even be after only a mere week of learning the SDK. Start with globally planning the thing, and dividing it in concrete to-do's. Consider every to-do a challenge and tackle accordingly. You will very quickly learn this way.
After a while your knowledge has expanded enough to reflect. When you just started writing the app, you inevitably made some mistakes. Now is the time to fix them and let your experience work its way.
And as previously mentioned, go nuts with google and SO. Of course, posting here proves your ability to use these tools properly. Above all, have fun.
It's possible.
Don't bother investing too many resources into books, especially if you want to save money. Stanford University have put up an excellent series of lectures for free from their iphone course that will get you up to speed with iPhone development, with a few assignments to do on the side (this is good because it offers some structure to your learning)
You can find this on iTunes (it might be reasonable to skip the 'introduction to objective-c' lectures if you're already familiar with the language)
Also it might be worth pointing out that if you want to develop an app on an iPx device you need to get a Developer License which will cost you a bit of money for membership. Although working off the simulator is completely free but doesn't replace trying your app out on a physical device.
ANother suggestions is to look for opesource projects and try to use them as your training exercise. Example:
http://sourceforge.net/projects/mtgr8-a3/
http://sourceforge.net/projects/mtgr8-jigsaw/
You can get a lot of help from iTunes U. Here is a very recent class which is packed full of useful information.
https://podcasts.apple.com/us/podcast/advanced-iphone-development-spring-2010/id407243032
There is also a class from Stanford University but I find it moves along slower, but it does cover a lot of material.
https://podcasts.apple.com/us/podcast/iphone-application-development-winter-2010/id384233225
If you search for "iPhone Application Development" on iTunes you will find other classes as well. I find that these classes, along with all of the available documentation and sample code from Apple, is a great way to learn Objective-C, Xcode and iPhone development.
3 months - full time - sure. Then the next year or so can be spent realising all the little things you did wrong and getting better. But don't let that hold you back, you can certainly do something functional in that time and it's the best way to learn.
I would not start with a book but use iTunes University. The first course available from Stanford was called CS193P Web Page (iTunes link) and it's a great place to start - seeing things done on video is easier for me than reading. More recent classes are also available though they do not publish every semester's class.

IPhone: Creating a Facebook like UI, Skinning Apps, Not following the AHIG

How do you design a UI like Facebook?
Is it hard to implement a custom skin into a iphone app? How is it done?
Do I need to follow apple's guideline? What if I don't want to?
How do you design a UI like Facebook?
Facebook's iPhone app appears to be built around using UITableView in various guises. It looks like it adheres to the Apple Human Interface Guidelines.
Is it hard to implement a custom skin
into a iphone app? How is it done?
Skins are just graphic elements that are designed to have their image components swapped out. They are not difficult to implement.
Do I need to follow apple's guideline?
What if I dont want to?
Apple will not penalize you for a non-standard interface. The only interface restrictions are (1) some issues of obscene content and (2) you can't create the illusion that the device itself is broken, has crashed or otherwise failed.
A bit of advice. Don't use non-standard interfaces.
Good interfaces are almost by definition standardized so that users don't have to think about them. Novel interfaces slow users down even if they have no problems otherwise. Just try switching rapidly between Mac, Windows and Linux sometimes. None of the interfaces has major problems per se but having to stop and think how to do something in each particular interface is a pain. You can create the same problem by using a good but non-standard interface within an app.
That is assuming of course that you can actually create a good interface. There are far, far more ways to make bad interfaces than there are to make good ones. Most interfaces fail even those designed by interface gods. The standardized interfaces are the result of tens of thousands of hours of testing and years of experience. You're unlikely to whip out something really new and useful your first time out.
If you try something novel I suggest you mock it up first and then test let people test it without giving them any instruction. You'd be surprised how complex it can get. We used to just make photoshop mockups and then ask test users what they thought each element did or which element they would choose to accomplish a particular task. We were surprised at how poorly our (the developers) perception of the interface overlapped with the perception of the users.
In sum, a novel interface is more likely to hurt your app than help it.
With regard to how to build an app like Facebook, check out Three20. In particular, the TTLauncherView is the class that implements the Springboard-like grid of icons.
3- You don't need to follow the AHIG. But be careful if you don't, because it's very easy to go wrong doing so. Users like to not have to learn anything new. They know the typical Apple software UI, so if you use it, users will know how to use your app as soon as they buy it. If you don't use it, it is important to make sure that the UI is exceedingly easy and intuitive, and looks good to an iPhone user's eyes (and fingers).

Pitfalls of developing for iPhone

Are there any guidelines on pitfalls to avoid while developing iPhone applications?
Sure, thousands. The same is true for any software development. Unfortunately, the easiest way to enumerate them is to write them down on a sheet of paper while waiting for a friendly soul to release you from the one you just fell into.
However:
Don't try to reinvent the wheel. The iPhone API is very complete -- you just have to LOOK for the facility you need. Things are NOT always implemented the way you would expect. Read the guides, carefully. Look at the tutorials and analyze how they work. (Try changing a line here or there in the tutorial to see what difference the change makes.) The single biggest mistake I have made in 1 year of iPhone development is not trying hard enough to find the iPhone way of doing something.
Don't ignore memory management; master it early and often. Use the Object Allocation and Leaks tools in Instruments to check for memory leaks frequently. I'd recommend checking after you complete each feature or view; more often than that if you keep finding bugs. Eventually you may understand it so well you can stop doing this.
Don't just use the default build settings. Play around with them to understand what they do. Figure out certification and distribution. GET INTO THE DEVELOPER PROGRAM QUICKLY -- it can take a while to push through that pipeline. [ AND when you get that notification that you need to renew, get it on instantly -- there have been problems with that process. ]
Don't neglect to read the Human Interface Guidelines (HIG) carefully. If they say not to do something -- DON'T DO IT. Apple will reject applications that misuse their iconography.
Don't stint on marketing. Yes, the App Store puts your app in front of millions of people... In theory. But the odds of getting front-paged are slim. There are a lot of great apps on the App Store that haven't sold much because no one knows about them.
Don't rest on your laurels. If a new technology comes out, find out if it makes your job easier; if it does, take the time to learn it. Personal example: I'm just now trying to switch from SQLite-based data management to Core Data, because I was in a hurry at the time I started my most recent project; now I wish I had slowed down and thought about it.
Don't go into your design thinking (for example) "How do I implement my concept with a table view?" It's true that table views are natural for many informational and utility applications, but don't be constrained. Instead, think about what users will want to be able to do, how you can make it easier for them -- put things together that will be used together, etc. If you've never explored the concept of Use Cases, read up on them.
Don't hesitate to build composite views. Many of the questions I have seen here on Stack Overflow have to do with putting a toolbar at the top of a table, or having an image in the background of a text field. I understand the desire to do things the easy way, and as I state in #1 above, if there is an easy way, use it. But in many cases the solution is just to layer a couple of views with appropriate placement and transparency.
Think about what might be Apple-approved from the start.
App Rejected is one of several useful sites to help understand Apple's mostly undocumented standards. (One more.) (A previous question on app store rejection reasons.)
A few quick examples:
Using a UIWebView can get your app a 17+ rating.
Coding with an undocumented/private API = rejected
Version number < 1.0 might= rejected
Not enough feedback about network success/fail = rejected
Too much network use = rejected
Clearly limited free version vs full version = rejected
The word 'iPhone' in the app name = rejected
The above links contain many more examples, and more details about those examples.
Don't neglect the programming guides. While the documentation is quite extensive, the programming guides contains a veritable trove of useful tips and "insider" information that simply cannot be gleaned from reading method definitions. I spend just as much time reading the guides for a technology (say, Core Data) as I do actually implementing it.
Don't assume you know what a method does. If you have any degree of doubt about the functionality of a method, it is well worth your time to go look it up in the documentation to verify.
Wonderful examples from #Amagrammer above.
I would love to add that the first place to start is iPhone development is Photoshop. This is still the best advice I can give to anyone who is starting out. I now use OmniGraffle because it has awesome stencil templates.
What I find is that even for super simple app's, draw up your prototype and look for usability issues and work flow issues. It is 100x quicker to redraw your app than re-code it. I have fallen into this trap numerous times and now actually draw up some pretty simple functionality to see what it will look and feel like.
This advice will save you 10s maybe even 100s of hours in hopefully getting your app right first time and getting you to think through what the issues are. Throwing away code sucks and I have done it not because the code was bad but because it made the usability or solution worse. I think the best of us end up throwing code away and prototyping your design definitely will help in having to RTFM for something you did not have to build in the first place.
If you don't have an great designer, and can't do great design by yourself, then don't even start iPhone app development. This rule only applies if you want/need to make money with your apps.

Should I Use a Framework While Learning Web Development

I realize that this may be subjective but I truly need an answer to this and I can't seem to find anything close enough to it in the rest of the Forum. I have read some folks say that the framework (any MVC framework) can obscure too many things while others say that it can promote good practices. I realize that frameworks are great for a certain level of programmer but what about individuals starting out? Should one just focus on the language or learn them together?
I think web development is way more than anyone grasps when they first start getting into it! Read this and know that it is all optional...but required to be really good at what you do.
I suggest that you spend time learning your language first. I would suggest learning C# simply because it is vastly more marketable and it is usually directly supported in most of MS products. By learning C# - programming in ASP.NET, console apps, servers, services, desktop apps, etc. will all be within your reach. You can program for most of the MS products as well as on many Linux type platforms.
Once you have this down then you can move to programming for the web as programming for the web has some intricacies that most other environments don't have. Concepts such as sessions, caching, state management, cross site scripting, styling, client side vs server side programming, browser support, how HTTP works, get vs post, how a form works, cookies, etc. are all at the top of the list of things to learn separately not to mention learning the ASP.NET base frameworks and namespaces.
Once you have the programming language down and then the concepts of web programming I suggest that you pause and learn database design. Don't worry about performance just yet...try to first learn good design. Performance will come next. A good start for you is Access (blasphemy I know). It is easy for a beginner to work with. And it translates into a more robust platform such as SQL Server easily. Learn at the very least some SQL...but I suggest that you learn as much as your stomach can handle. I heard someone say that SQL is like the assembly language of the database. The number one thing that slows an application to a halt is piss poor database design and poor queries. Once you have this knowledge - stuff it away in the back of your mind and take a look at a good ORM. NHybernate is probably best at the moment but is more complex that the basic learner needs. For that reason I currently suggest getting LINQ to SQL up and running as it is SUPER EASY to work with. Then look at Entity Framework (although I still think it sucks...and you should wait till EF 2.0...ERRRRR...now 4.0 released with .net 4.0). Then NHybernate.
Now is the time to start to understand the infrastructure that is required by web development. You may bump your head against this as you learn some of the web programming stuff. But you need to understand the basics of DNS, IIS, load balancers, sticky routing, round robin, clustering, fault tolerance, server hardware setup, web farms, cache farms (MemCached Win32, Velocity), SMTP, MSMQ, database mail queuing, etc. Many people may say you don't need this. That there will be some knowledgeable network admin to help you out here. However they generally know things that impact them...not you. The more you know here the more valuable you will be to the company that hires you.
Now you can get into the details of best practices and design patterns. Learn about the basics such as repository pattern, factory pattern, facade pattern, model view presenter pattern, model view controller pattern, observer pattern, and various other things. Follow Martin Fowler and others for suggestions here. Take a look at concepts such as inversion of control, dependency injection, SOLID principle, DRY, FIT, test driven design, and domain driven design, etc. Learn as much as you can here before moving to the next step.
NOW you can think about frameworks! Start by creating a basic application with ASP Classic (comes with IIS for free!). This will give you a flavor of a no frills web development environment. Take a look at ASP.NET web forms (briefly) to see how MS attempted to make things easier by hiding all the complex stuff (which you now know how to manage on your own from your readings of the above materials!!!). Now you no longer need ASP.NET Web Forms. Move immediately to ASP.NET MVC. The MVC framwork gives you all the power you need to create a good easily manageable web application. If you build something really big no framework for pure web development may be able to deal with what you need. However MVC is way more extensible for such UBER custom scenarios.
Now that you have made it through the journey to ASP.NET MVC you can take a look at things such as Microsofts Enterprise Application Blocks (such as they use at MySpace). Take a look at Elmah error logging (a must have). Look at how to build a custom SiteMapProvider for your MVC site. If you need to get into searching stuff understand Lucene.NET.
And if you made it this far...you are ready to figure out the rest on your own as it comes up! Have fun. There is a lot of room in this space for a person with some understanding of all of the above concepts.
You'll be using SOME sort of framework. The question is, what level do you want to learn at?
You'll probably not care to learn about asynchronous I/O and mutlithreaded vs. select/poll styles of web servers.
So then, your language of choice is going to provide a layer atop this, the languages preferred "web interface" API. For Java it's Servlets, the lowest level you'd typically code at for server side web applications.
You should find what this "lower level" layer is in your language and learn the API at least. You should know basic HTTP like status codes, cookies, redirects, POST vs GET, URL encoding, and possibly what some of the more important headers do.
You'll then come to appreciate what these higher level frameworks bring to the table, and be better able to evaluate what is the appropriate level of abstraction for your needs/project.
Web development requires a certain degree of organization, since it relies so much on separation of concerns. The browser, for example, is designed to display data and interact with the user. It is not designed to lookup data from a database, or perform analysis. Consequently, a web development framework can help provide services that are needed to make the browser experience a practical one.
The nice thing about employing a platform is that it will provide core components essential to the making of any web application that you won't (and shouldn't) have to think about, such as user membership, for example. Many of the design decisions and deep thinking about how to implement these services has already been done for you, freeing you to focus on what you actually want you application to do.
Of the available frameworks, I find that frameworks that implement the MVC (model-view-controller) pattern are very practical. They clearly organize different functions of web development, while giving you full control over the markup presented to the browser.
All that said, you will need some fundamental skills to fully realize web development, such as HTML, CSS, and a core programming language for the actual underlying program, whether you use a platform or not.
I don't think I agree with the Andrew. I don't think learning C is a pre requisite for web development. In fact, learning something like Javascript, Action-script or PHP is often easier due in large part to the vast numbers of sites and tutorials available, and are enough to expose you to the fundamentals of pretty much every programing language. Variable, Conditions, Loops and OOP. I just think learning C# introduces a lot of learning that isn't really relevant to web development such as pointers and memory management.
As for wether you should learn a framework first? Definitely not. Never ever. You need to be able to stand on your own two feet first and be comfortable with HTML/CSS, Server Side Scripting (PHP/ASP/Python/Ruby whatever) and love it or loathe it, but you're going to have to have a decent understanding of Flash and Action-script.
The order in which you learn these is entirely up to you. But my learning plan would go like this...
Start with HTML. It takes about half an hour to get the basics (it's made up of tags with attributes, end of lesson 1) and it's good to get it out of the way first.
Then start leaning CSS. You'll get the basics again, very quickly. But CSS is a minefield so expect to spend the rest of your life figuring it out.
Next up Action-script. Most people wouldn't agree with me, but bear with me. HTML and CSS aren't programming languages. Action-script is. And learning a programing language for the first time is difficult and tedious. The advantage Action-script has over most other languages is that the results are very visual. It's enjoyable to work with and you can sit back and take pride in your accomplishments at regular intervals. This isn't possible with server-side scripting languages or Javascript and there's a whole host of stuff you need to learn to get server side scripting up and running. You can't build space invaders in with PHP for example.
I've changed my thinking here. I would encourage beginners to ignore ActionScript and focus on Javascript. I still believe that being able to see stuff on screen quickly is a good motivator, but I would encourage people to look at canvas tag tutorials and frameworks. Javascript has come a long way since 2009, and is now the lingua franca of programming, so it's incredibly useful. My initial point about HTML and CSS not being programming languages still stands.
Then, you can start with your server side language. At the same time, you're going to have to figure out the database stuff. I recommend PHP and MySQL because it's free.
Again, I've changed my thinking here. I would encourage beginners to use Javascript on the backend (Node.js), and split their database learning between relational databases and noSql solutions such as Mongo.
Then.... learn your framework. Or better yet, roll your own. That's what I've been doing and it's supercharged my learning.
If you're getting into web development, You HAVE to know how those building blocks work. You don't have to be an expert in all the areas, but you should try to become an expert in at least one of them. If you start learning a framework before you get the fundamentals you'll be in a sticky middle ground where you don't understand why things don't work which will infuriate you, and anyone who has to work with you.
you should learn how to use framework because it would be helpfull for u in the future also it is easier to learn.
MVC will help you a lot .. trust me ... i was developing web project not using mvc and it is like mess ... (in the past there are no well know mvc and i never heard about it)
Short version: yes, and then some.
FWIW : This more generic answer may be of use to someone out there.
What: Frameworks take out tedium of using boiler-plate code again and again. They hide complexity and design issues under wizards and conventions. They also use special libraries, design patterns etc. in ways that are far from obvious to a beginner.
So using a framework is good for getting things done without knowing exactly how - like using an ATM without knowing the internals. You just add your code bits in certain places and things 'just work'.
HTML > CSS > Ruby > SQL > Rails/Javascript framework > Libraries would make for a good learning track. Rest you learn as you go along by being curious, hanging out on forums or as extended learning as need arises.
HOW: The problem starts the minute you step outside simple text-book examples (i.e. when you try to get it to do something even a bit different).
Decoding cryptic error messages when it seems like you've done everything right but things still don't work. Searching on error strings in forums may help out. Or just re-starting from scratch.
Reading up articles and books, videos, trial-and-error, hard-work, search-engines, stackoverflow/forums, local gurus, design articles, using libraries, source-code browsing are a good way to climb the learning curve gently and on a requirement basis.
Working-against-the-framework is the number one problem for beginners. Understanding what the framework expects is key to avoiding white-hair in this phase. Having enough insight to manually do what the framework automates may help reduce this second-guessing effort.
WHY: For more advanced debugging/design, it's good to know what the framework is doing under the hood esp. when things don't work as you planned. Initially you can take the help of local-gurus or forum gurus who've already done the hard work. Later as you go deeper you can take on more of that role. For example there's a "rebuilding rails" book which looks under the hood of Ruby on Rails.
Note: Some of the tips are oriented towards Ruby/Rails but you can easily substitute your favourite language/framework instead.