Initializing the Core Data Stack

This post is a little memo I made for myself. Hope it will be useful to you too. You can find the sample code in Apple’s Core Data Programming Guide.

Here are the steps you take to initialise the Core Data Stack.

  1. Initialise Managed Object Model with modelURL. The model file may look like “DataModel.momd” and is located in the main bundle of your project.
  2. Initialise Persistent Store Coordinator with Managed Object Model from step 1.
  3. Initialise Managed Object Context. You can save it as a property, to access it later.
  4. Take Persistent Store Coordinator from step 2 and set it as a Persistent Store Coordinator of the Managed Object Context from step 3.
  5. Create storeURL. Your store can be named something like “DataModel.sqlite”, and should be placed in the Documents directory.
  6. Using the storeURL from step 5 add the store  to the Persistent Store Coordinator from step 2.

That’s it. You should end up with something that looks like this:

On writing short posts from now on

Today I came up with an idea of how I should run my blog from now on.

Here is the thing. I learn something about programming every day. But what I learn during one day is usually not enough to make for a good, average sized article on this blog. Of course, I can just research a specific topic for several days and when I have enough to say about the topic write a blog post. That’s the way I was trying to run this blog up until now.

But the problem is that I am not very consistent with my topics. I switch them very often. Some time ago I decided to create a web app with JavaMail and MySQL server (I wrote a post about it). The next day I thought it would be cool if I was able to do some UI/UX design on top of programming. So I started learning photoshop. Couple of days ago I had to use some Python on my job (I learned a little bit of Python a long time ago, but I have never used it at my job before). As a result I got interested in Python, so now I want to learn more about it. And so on.

What I like about my blog posts is that I can always come back to them and be reminded of the stuff that I have once learned. I like to use this blog as my personal learning diary. That way I don’t have to Google the same stuff over and over again. But again, the problem is that, because I am not consistent with my topics, I don’t write a lot of articles on this blog.

And here is my idea. What if instead of trying to write normal sized articles I would just write every day about the stuff that I learned that day. Sure, these short articles will be of lesser value for the readers. But at least I will be able to write on a regular basis. And I will have my learning diary, which is super cool.

That’s it. I don’t want to commit myself to daily blogging just yet, but I suspect that I will in the near future.

For now I just allow myself to write short posts. 

My new project – creating an email subscription web service (Part 1)

This post starts a series of posts on me creating a certain web app. I will create this app for educational purposed as I am currently learning web development. As you may know, my specialty is iOS development, but I feel like I need to get at least some experience in server side development.

The best way to learn how to program is to build something for real, so I have chosen to create an email subscription web service. You know, the kind of service for entrepreneurs that allows them to build lists of their potential customers with emails. The one example of such an app that I know of is MailChimp. So, I’m going to do something similar.

There will be a difference though, that will make things much easier for me. The difference is that my app will be entirely mine, meaning that I will be its only user. This app will help me collect the emails of other people. Who are those other people? Maybe the future readers of my blog. Maybe future customers of my future businesses. Who knows? The thing is that creating such an app is a challenging task and it requires learning a lot of useful stuff, like programming a web app and designing a database.

I will be using Java server with JavaMail framework and MySQL database. Mind you I don’t know much about any of those things. I will be learning them along the way as I will be developing my app.

The first step: database

First of all I guess I’m going to design a database. I have a MySQL server installed on my computer. I have already created a database called email_subscription_db in it. Before creating tables and populating them with data I decided that I should learn how to use some visual tool for dealing with databases. Designing a database through Terminal window requires too much typing. So I downloaded MySQL Workbench. I looked at it and it seems easy to use. I haven’t done much with it yet, though.

Before creating tables I need to figure out exactly which tables I will need. And still before that I need to decide what things my app should be able to do, because that will determine what tables I’ll be using.

Web app features

First of all there should be multiple lists of people. And I should be able to send different emails to different lists of people. Also it should be possible to send series of emails that were prepared in advance. I should be able to see the history of my communication with my subscribers as well as stats. It already sounds too complicated for me. Let’s simplify things a little bit. I don’t need to create the whole app in one iteration. For now I can create just a tiny part of the app with the most necessary functionality.

Simplification

So, what are the things that I need right now? I’ll keep multiple lists, because they are not so hard to create. But I will forget about preprogrammed series of emails for now. And no stats. Basically what I need to be able to do is choose one list of subscribers and send them one letter.

Now what tables do I need to accomplish just that? Here is a list of tables that I think I will need.

  1. people table which will contain peoples emails, names and other information
  2.  lists table which will contain basically the names of the lists of subscribers. 
  3. Lists and people have a many-to-many relationship, meaning that one person can subscribe to multiple lists, and vice versa: one list can have multiple subscribers. To connect the two tables together I need an intermediate table, which I will call Subscriptions. Each subscription will contain an id of a person and an id of a list to which that person is subscribed.
  4. Letters table. This is a table that will contain the letters that I’ll be sending to my subscribers. Each letter will belong to exactly one list. For now this table won’t contain any information on the time when the letter were sent. Or, you know what? Maybe I don’t even need this last table right now. In the first release of my app there will be no way to save letters, so there really is no need for this table.

So, that’s it. I only need three tables: people, lists and subscriptions.

Now I’m going to start playing around with MySQL Workbench.

Part 2

How I became a professional iOS developer in 12 months

In this post I’m going to share my story with you. If you plan to change careers and go into IT, it might serve you as an example. I’m sure there are many ways to go into IT, and the way I did it might not be appropriate for you, but anyway…

My previous profession

So, let’s start from the beginning. After I graduated from university in my home city of Stavropol (Russia) I went to work as a civil engineer at a company located in the same city. The work was all about oil field development. My job was to design all sorts of structures that are needed on oil fields like foundations for different modular buildings, structures that support oil pipes and many others. It seemed like a cool job at first, but I soon realised that there was no place for creativity in that  job. After you learn the basics you just repeat the same process over and over again, copying the same stuff (with little modifications) from one AutoCad drawing to another. I worked there for 2 years. All this time I lived in my parents’ house.

Then I decided to move to Moscow. How I did it with just 50000 rubles in my pocket and what  misadventures I had to go through is a whole separate story. Let me just tell you it wasn’t as easy as I thought it would be. I couldn’t find a job for 4 months.

Finally I was able to get a job. Now my job was to design so called structural health monitoring systems. It was more interesting than my previous job, and I liked it at first. But after some time it became pretty much repetitive. It also didn’t pay well.

By the way, what I hated most about my two engineering jobs is that they were not intellectually demanding. I always felt that I wasn’t  realising my potential. I did the work that can be done by people who are not so bright as I was. And what’s irritating, those people got promoted all the time, not me. Because I don’t have people skills, I’m not talkative and so on. Basically, I felt that I was in the wrong place.

How I decided to go into IT

I have a friend in Moscow who works in IT. He’s a product manager. And he’s always  been telling  me that I could become a good programmer. He advised me to take courses on programming, which I did. The idea was simple: I would learn programming, find a job as a programmer and eventually start to make 2 or 3 times more money than I was making at that time, plus programming is more intellectually demanding activity than filling spreadsheets and editing Word files, so hopefully I wouldn’t be bored all the time.

So, for almost one year in 2011 – 2012 I attended a university on weekends. I was studying Java development. Actually the courses were more general than that. I would learn a little bit about everything in the IT field. As for the actual Java development, there wasn’t a lot of practical stuff in those courses.

Towards the end of that studying I caught a entrepreneurial disease. I watched some YouTube videos, read some books and was convinced that I needed to become a businessman. Immediately. I quit my courses even though I had only one month left to finish them properly and get my degree. I became what is called a wantrepreneur. At first I tried to do MLM. After four months I decided that was not a good idea. Then I tried to do infobusiness for several months. It went a little bit better, but still I couldn’t make money: I was paying more money for the ads than I was getting money from my customers. So eventually I quit that too. I did all this stuff as I was working at my day job.

Finally, after all my attempts to start a business failed, I found myself in a pretty nasty situation. At that point I’d been working at my job for 4 years. I had no new business ideas left. The initial plan to enter the IT was long forgotten. I remember that all I could think of at that time was how much I hated my job.

Luckily, at the very same time I had saved a large amount of money. Since I hated my job so much, for years I’ve been getting myself ready to quit it by saving money. Finally, I quit my job when I had enough money to live in Moscow unemployed for 2 years. I mean no buying stuff, no entertainment, just paying rent and buying food.

You might ask why save so much money in order to quit the job. The reason was that I didn’t just want to quit my job to immediately find another one. I needed to do something different. I didn’t know what, exactly. I needed time to think.

After one month of thinking (while living in Moscow, which is costly for an unemployed person) I still didn’t know what to do, so I started looking for a job. I really didn’t want to get another job as a civil engineer so I was kind of depressed at that time. Actually I didn’t really look for a job, I was just reading through job postings on the internet thinking to myself how sad it was that I’d learned to earn my living by doing things that I hate.

Just at that period of time I met with my friend I told you about a while ago. The IT guy. And while we were discussing my situation he reminded me of my intention to enter the IT. I’d totally forgotten about it, by the way. For some reason I didn’t remember about the IT thing during the whole month I was unemployed in Moscow. But as soon as my friend reminded me that I still had that option, I knew that moment that was exactly what I’d do.

It was the best thing I could do in that situation. I couldn’t stand a thought of just getting another job at that time. And I had plenty of money. So I could spent some time just learning to code. I decided to learn iOS development so I bought myself a MacBook Air. And I already had an iPad at that time. So that’s how I started. There was no reason to stay in Moscow while I was learning, so I moved back to Stavropol to live with my parents. There I only spent money on my food. I didn’t go out much. So I calculated that with that kind of living and with the amount of money that I had I could afford to be unemployed for about 4 years if I wanted to. But I figured that one year would be more than enough to learn programming.

How I learned the actual stuff

I started with the Stanford SC193P lectures on iOS development. I watched all those lectures in the first month of my studying while I was still in Moscow. Well, let me give you some timing.

I quit my job in the beginning of August 2014.

I decided to study iOS development in the beginning of September 2014.

I moved to Stavropol in the middle of October 2014.

I moved back to Moscow and got my first job as a programmer in the middle of August 2015.

So, for the first month I just watched lectures and did my homework. Then I did some tutorials. I released my first app to the App Store in November 2014, I believe. Then I spent several months till March 2015 making and releasing my other apps. Here are my apps, by the way, if you want to check them out:

https://itunes.apple.com/ru/developer/karen-grigoryan/id948320401

At the beginning I planned to become a freelancer. I didn’t like the idea of working in the office. And I wanted to travel. I even seriously considered the option of moving to Thailand instead of my home city, to learn programming. Good thing I didn’t do that.

At the beginning of 2015 I registered at oDesk (now UpWork) to become a freelancer. I even got a Payoneer card to collect my money that I would make there. But I soon realised that I didn’t have enough experience to get any serious offers. And the easy tasks were hard to get, because too many people could do them. So, I decided that after my study is over I should return to the corporate world for at least several years before thinking about freelancing again.

After March 2015 I started looking at the job postings. I made a list of common requirements for the iOS development jobs. And I started to learn the required technologies one by one.

At about the same time my IT friend decided to start a business. He created a hotel booking site, took a leave of absence from his job and started to work on his business. He told me that I could create an app for his business if I wanted. That way I could practise on a real world business app, and later I’d be able to show this app off on a job interview. So, I spent about one month working on the hotel booking app for my friend’s business. I never finished it, though. And my friend’s business never took off. But I still used that unfinished app during my job interviews when I was looking for my first IT job. And I learned a lot while making this app, so working on this app was not a complete waste of time.

How I finally got my first IT job

Couple of months later, in the beginning of August 2015, I decided to look for a job for real. The first hurdle that came my way was that there were almost no job postings, appropriate for me. All the jobs had very high requirements. At that point I didn’t understand one simple thing. If your skills don’t match the requirements listed in a job posting, that doesn’t mean you can’t apply for that job. You always have a chance. But I didn’t know about it. So, looking through job postings I felt kind of depressed. I even started to doubt if I could ever enter the IT. What if my entire plan was a big mistake?

Then I tried another approach. I found a list of top 100 Russian mobile development companies. About 20 of them were located in Moscow. About 10 were in Saint-Petersburg. Others were in a bunch of other major Russian cities. My plan was simple. I would send my resume to all the Moscow companies first (at that point I was still in Stavropol, the South of Russia). Then when I get job interviews I’d go to Moscow and live in a hostel there temporarily. If I wasn’t lucky and nobody wanted to hire me, I would send my resume to the Saint-Petersburg companies, then move there and repeat the process. Then, if nobody wanted me there either, I’d do the same approach with other cities. I would visit those cities one by one until I finally find a job somewhere.

It turned out everything was much easier than I expected. I got a job on my very first interview. I had a couple more interviews after the first one, but I went there only out of curiosity, because I already knew that I had a job at that point.   

And that’s how I became a professional iOS developer in 12 months. Maybe later I will add some concluding thoughts here.

What kind of apps to create to make money

If you look at my apps in the App Store, you’ll find out that they (with the exception of my silly game Ugly Plants) are all related to productivity in some way or another. And they are all pretty basic. They are simple. They don’t have server side. They are journals and to-do lists. There is a reason for why it is that way.

Create only useful apps

My first app was Simple Q&A Diary. I had the idea for this app long before I started learning iOS development. I didn’t think it was going to be a mobile app at that time, though. I thought maybe someday I’d create a web app. But I wasn’t sure how I would do it as I lacked experience in coding.  Also I’d have to work on registration and sign in features, which was too complicated for someone who wasn’t even a newbie in programming. At that time I only dreamed that someday I’d learn programming. So it wasn’t a real plan.

Then, when I decided to learn iOS development and I needed to create my first app, I had the idea ready. And what was good about realising my idea in the form of a mobile app was that in a mobile app there was no need to register and log in the users. And the mobile device didn’t need to connect to the internet in order for the app to work. So I created this app. It was a huge success compared to my other apps. It makes me more then $100 a year.

Then I created a game called Ugly Plants. It is a total failure. Nobody likes it. And nobody can find it on the App Store, since nobody is looking for ugly plants. I don’t know what keywords to use to make the game more searchable (or should I say findable?). Anyway, I decided to never make games again, and instead only create useful apps.

Learn from your successes

Ok, let’s not go into the history of all my apps. Let me just tell you what I do to make money from my apps. Here are the guiding principles that I use. First of all, I try to learn from my successes. I know there is a ton of advice on how to promote your app. I don’t use most of it. I don’t have time for PR and I found out that social networks are mostly useless. I guess social networks might be useful if you take them seriously enough and dedicate a lot of time to them. But I don’t have time. I have a full time job. And I don’t take my apps that seriously. The real reason for creating apps is not money but honing my developer skills. And I create apps that I use myself, so even if nobody likes them I haven’t wasted my time creating them. More on that later.

Success for me is having an app that generates $100 a year. Then creating another app that generates $100 a year. Then improve one of my apps so that it starts generating $150 a year. And so on.

How to get an idea for an app? Create apps for yourself

I don’t try to figure out what other people might need. You can do a market research. There is nothing wrong about it. But if you go down that road it is so easy to get mistaken. I personally don’t do it. What I do instead is I create apps for myself. The way I look at it is this. I’m not a unique snowflake. If I need something there must be thousands of people who need the same thing. So, if I create an app for myself, somebody is going to buy it. And that’s what’s happening to my apps. I regularly use all of my apps except that silly game – Ugly Plants. And I see that people are using all of my apps except that silly game that I myself don’t play.

How I price my apps

When I first uploaded my very first app Simple Q&A Diary I made it free. The reason was that I didn’t have my banking account ready for receiving money from the App Store. So the app was free for several months. Then when my banking account was ready I priced the app at $1. It was at that price for quite some time. It was making about $5 a month. Then as an experiment I priced it at $2 for one month. The amount of downloads that month was the same. So by changing the price I doubled my income from this app. I thought maybe it was not the end, so I priced it at $3 for the next month. And the income was much smaller. So I returned it back to $2. That’s how I picked the right price for my first app.

I used the same approach to picking the price for my other apps ever since. I always start small and then increase the price by $1 every month. You need to wait for at least a month to gather enough statistics before changing the price.

One more thing. When I release a paid app I always release it as free first. I keep it free for several days and only after that I put a price on it. The reason for this is that I think there is a high probability that large amount of downloads at the beginning will improve the App Store ratings for the app later on. I always notice that right after release or an update of an app it is actively downloaded for several days and then the number of downloads decreases abruptly and stays low after that. I think that at the beginning the App Store shows your app to some large number of people and rates your app based on their behaviour. The more people from that first sample audience downloaded your app the higher the rating it is going to get. It is just a theory but it looks logical and it explains what I see in the stats of my apps.

Have free apps

I have a free app called Stream Journal. It is downloaded about 5 times a day. I put a button ‘Info’ into it that opens my site in Safari. According to the analytics of my site about 100% of people who downloaded my app visit my site. There they can see my other apps. I don’t know how many of them buy my paid apps. But I think it’s nice to have an audience of hundreds and thousands of people. Later on I’ll be able to promote my paid apps inside my free apps. I’ll be able to use Push Notifications to talk to my audience which is about 2000 people at the time of this writing.

Have a good design

A good design is important. So it is worth it to at least try to make your app look nice. Learning a little bit of Photoshop won’t hurt you, even if you don’t plan to become a designer. But sometimes you don’t even need Photoshop to make your app look a little better. Basically you just need to care about the looks of you app and make at least some effort. When I created my first couple of apps I didn’t think about good design at all. Then when I finally decided to do something about the ugliness of my apps my sales doubled. Take a look at this picture:

comparison of designs

And I didn’t even use Photoshop a lot. Most of the work was done in the Xcode’s Storyboard. The result doesn’t look great, but it looks much better than what was before. That’s the point. If you want your apps to sell, make sure that they at least don’t look like shit.

So, that’s about it. Now you know how I make money on App Store.