본문 바로가기

Programming

좋은 변수 명명법 - '읽기 좋은 코드가 좋은 코드다' 참고 최근에 책 한 권을 샀다.프로그래밍 방법론에 관한 책은 마틴 파울러의 Refactoring 이후로 두 번째 인거 같다. 이제 프로그래밍 경력이 쌓이다 보니, 프로그래밍 자체보다 프로그래밍 방법론과 협업에 관련한 서적들에 관심이 간다. 이 책은 좋은 코드를 작성하는 방법을 풍부한 예제와 쉬운 설명으로 제시하고 있어, 프로그래밍 변수 명명법 등등 프로그래밍 스킬을 보다 높은 차원으로 업그레이드 하고자 하는 사람들은 누구나 좋아하고 쉽게 익힐 수 있는 책이다. 읽기 좋은 코드가 좋은 코드다저자더스틴 보즈웰 지음출판사한빛미디어 | 2012-04-06 출간카테고리컴퓨터/IT책소개이 책은 코드를 작성할 때 언제나 적용할 수 있는 기본적인 원리... 그 중에서 책의 첫 번째 파트에 나오는 일부 요약을 살펴보면 아래와.. 더보기
Ruby 간단한 파일 읽기 쓰기 프로그램 예제 Ruby 언어를 이용하면 간단한 파일 처리 프로그램을 빠른 시간안에 효율적으로 작성할 수 있다. 파일 여는 것은 아주 간단하다. f = File.open("파일이름", "모드") 파일을 쓰는 것 또한 간단하다. f = File.open("파일이름", "모드") 여기서 모드는 "r" (Read), "w" (Write), "a" (Append) 가 있다. 파일의 내용을 읽는 방법은 아래와 같다. f.each_line do | line | puts line end 파일에 내용을 쓰는 방법은 아래와 같다. f.puts "내용" 루비에서는 커맨드 라인 인자를 읽어들일 수 있는데 따로 사용하는 키워드가 있다.ARGV 라고 한다. ARGV 는 배열처럼 되어 있어서 배열 첨자를 이용하면 쉽게 접근 가능하다. ARGV[.. 더보기
Spring Hello World! Spring framework 를 이용하여, Hello World 프로그램을 작성 해 보자. 먼저 Spring framework 를 다운로드 하도록 하자. (아래 링크에서 받자)http://www.springsource.org/download Spring framework 는 apache-commons-logging 을 사용하므로, 이것도 다운로드 받자.http://commons.apache.org/logging/ 그 다음, Eclipse EE 를 다운로드 하도록 하자. (Eclipse IDE for Java EE developers)http://www.eclipse.org/downloads/ 1. Eclipse 에서 HelloWorld 라는 프로젝트를 생성하자.2. 생성한 프로젝트에 lib 라는 폴더를.. 더보기
Map, HashMap 순회하기 Map 을 순회하면서 어떤 일을 하기 위해서는 여러가지 방법을 사용할 수 있는데, 그 중에서1. entrySet() 을 사용하는 방법2. keySet() 을 사용하는 방법3. values() 를 사용하는 방법 으로 총 3가지가 있다. entrySet() 은 key 와 value 두 개 모두가 필요할 경우 사용하며,keySet() 은 key 값만 필요할 경우 사용, values() 는 값들만 필요할 경우에 사용한다. 각각의 사용법을 살펴보면 아래와 같다. 1. entrySet() 을 사용하는 방법 Map map = new HashMap(); ... for (Map.Entry entry : map.entrySet()) { String key = entry.getKey(); Object value = entr.. 더보기
iOS - Core Location Core Location 의 특징에 대해서 알아 보는 시간을 가져 볼까한다. Core Location uses a fair amount of power while it's running, so it's best to shut it down if you don't need it. Core Location will try to cache previous position information so it can give you something as quickly as possible. Because of this, if you're really concerned about accuracy, you should check the timestamp sent along with the position informa.. 더보기
Persistent Obj Store Persistent Obj StoreActually reads and writes the data. (실제로 데이터를 읽고 쓴다)Does data migration, sometimes without actually needing to load the data. (데이터를 이동시킨다. 때때로 데이터를 로드시킬 필요가 없다.)Uses mapping models if the changes are too much for lightweight migration. (변경된 점이 너무 많아서 lightweight migration 을 수행할 수 없을 경우에는 mapping model 을 사용한다.) Data MigrationCore Data can use lightweight migration to automatic.. 더보기
NSFetchedRequest NSFetchedRequest, NSFetchedResultsController, NSPredicateNSFetchedRequest can take an NSPredicate to filter data based on logical conditions. (NSFetchedRequest 는 논리적인 상태에 기반하여 데이터를 filtering 하기 위해서 NSPredicate 를 사용할 수 있다)You can express NSPredicate conditions in code or using Xcode's predicate builder. (NSPredicate 는 코드로 혹은, Xcode 의 predicate builder 를 사용하여 작성할 수 있다)NSFetchedResultsController pr.. 더보기
Managed Object Context Managed Object Context - NSManagedObjectContext - From Head First iPhone & iPad development 2nd edition If you want to create a new instance of an NSManagedObject, you just do this: [NSEntityDescription insertNewObjectForEntityForName:@"Fugitive" in ManagedObjectContext:managedObjectContext];. The Managed Object Context is provided right from the start.Most Core Data load/save operations point t.. 더보기
The Data Model About Core Data For future reference, I've written this from Head First iPhone and iPad Development (2nd edition) The Data Model Works with entities that have properties called attributes.Can be edited directly in Xcode.Has several different data types. Core Data Provides stack that manages the data so you don't have to.Can manage different types of data.Great for memory management and tracking .. 더보기
iPad HIG, Universal App, Device Checking, Split View Controller 오늘은 iPad 관련하여 iOS 에서사용되는 개념을 정리 해 볼까한다. 1. iPad HIG iPad HIG 는 iPad 를 위한 Human Interface Guideline 이고, iPad 에 특화된 컨트롤들이 있는데, 이 특화된 컨트롤들은 iPhone 에서 사용하는 방법이 많이 틀리다. 그리고 디자인의 방법도 다르다. 그 중에서, Split View 와 Pop Over 컨트롤들은 iPad 에 특화된 컨트롤들이다. 2. Universal App 보통 iPhone App 을 개발할 때, 고려할 사항이 3가지가 있는데, iPhone 만을 위한 앱이냐, iPad 만을 위한 앱이냐 혹은, 둘 다 지원하는 Universal 앱이냐 인데, Universal 앱은 두 가지 장치를 위한 각각의 앱을 작성할 필요가 .. 더보기